All Projects → jdrew1303 → Sqlgenerate

jdrew1303 / Sqlgenerate

Licence: mit
Generates SQL when given an AST from the Codeschool/sqlite-parser

Labels

Projects that are alternatives of or similar to Sqlgenerate

Node Sqlite3
Asynchronous, non-blocking SQLite3 bindings for Node.js
Stars: ✭ 5,083 (+36207.14%)
Mutual labels:  plpgsql
Odata V4 Typeorm
OData to TYPEORM query compiler
Stars: ✭ 16 (+14.29%)
Mutual labels:  plpgsql
Foodnutrition
食物营养大数据
Stars: ✭ 27 (+92.86%)
Mutual labels:  plpgsql
Postgrest Starter Kit
Starter Kit and tooling for authoring REST API backends with PostgREST
Stars: ✭ 657 (+4592.86%)
Mutual labels:  plpgsql
Mysql Deadlocks
收集一些常见的 MySQL 死锁案例
Stars: ✭ 777 (+5450%)
Mutual labels:  plpgsql
Pg query internals
Query PostgreSQL internals using SQL
Stars: ✭ 17 (+21.43%)
Mutual labels:  plpgsql
Mixerp
Open Source ERP, HRM, MRP, MPS
Stars: ✭ 472 (+3271.43%)
Mutual labels:  plpgsql
Medrianchor
The (Me)tadata (Dr)iven (Anchor) Model
Stars: ✭ 9 (-35.71%)
Mutual labels:  plpgsql
Chinook Database
Sample database for SQL Server, Oracle, MySQL, PostgreSQL, SQLite, DB2
Stars: ✭ 786 (+5514.29%)
Mutual labels:  plpgsql
Mallcloud Platform
mallcloud商城基于SpringBoot2.x、SpringCloud和SpringCloudAlibaba并采用前后端分离vue的企业级微服务敏捷开发系统架构。并引入组件化的思想实现高内聚低耦合,项目代码简洁注释丰富上手容易,适合学习和企业中使用。真正实现了基于RBAC、jwt和oauth2的无状态统一权限认证的解决方案,面向互联网设计同时适合B端和C端用户,支持CI/CD多环境部署,并提供应用管理方便第三方系统接入;同时还集合各种微服务治理功能和监控功能。模块包括:企业级的认证系统、开发平台、应用监控、慢sql监控、统一日志、单点登录、Redis分布式高速缓存、配置中心、分布式任务调度、接口文档、代码生成等等
Stars: ✭ 27 (+92.86%)
Mutual labels:  plpgsql
Blog
Everything about database,business.(Most for PostgreSQL).
Stars: ✭ 6,330 (+45114.29%)
Mutual labels:  plpgsql
Mysql Sys
The MySQL sys schema
Stars: ✭ 758 (+5314.29%)
Mutual labels:  plpgsql
Geocode
Batch geocoding addressess, map to census block with PostGIS Tiger Geocoder
Stars: ✭ 23 (+64.29%)
Mutual labels:  plpgsql
Pgtap
PostgreSQL Unit Testing Suite
Stars: ✭ 631 (+4407.14%)
Mutual labels:  plpgsql
Elite
Stars: ✭ 7 (-50%)
Mutual labels:  plpgsql
Audit Trigger
Simple, easily customised trigger-based auditing for PostgreSQL (Postgres). See also pgaudit.
Stars: ✭ 493 (+3421.43%)
Mutual labels:  plpgsql
Pg Mask
Simple data masking for PostgreSQL
Stars: ✭ 16 (+14.29%)
Mutual labels:  plpgsql
Basketball Data Scraper
A scraping library that gets you basketball data for the NBA and WNBA
Stars: ✭ 13 (-7.14%)
Mutual labels:  plpgsql
Scidb4geo
A SciDB Plugin for Managing Spatial and Temporal Reference Information of Arrays
Stars: ✭ 8 (-42.86%)
Mutual labels:  plpgsql
Postgis
PostGIS spatial database extension to PostgreSQL [mirror]
Stars: ✭ 925 (+6507.14%)
Mutual labels:  plpgsql

Overview | Features | Installation | Credits | Issues


Overview

SQLGenerate takes the Codeschool sqlite-parser AST and generates SQL from it. This allows you to read code (using the Codeschool parser), manipulate the AST (using SQLTraverse) and then generate SQL (using this library 😄).

⬆️

Features

⬆️

Installation

npm install sqlgenerator 👍 done!

⬆️

Using this project

The blow example is a simple case of parsing SQL to an ast and then back again to SQL. One of the better use case for this is to modify your SQL somehow. To do this you can use sqltraverse (yes it's a shameless plug 😁).

import parser       from 'sqlite-parser';
import { generate } from 'sqlgenerate';
import { format }   from "sql-formatter";

const example = `
  SELECT m.title, r.id AS [Theatre Number]
  FROM Movies AS m
  INNER JOIN (
    SELECT r2.movie_id
    FROM Rooms AS r2
    WHERE (r2.seats >= 50)
  ) AS r
  ON ((m.id = r.movie_id) AND (m.title != 'Batman'));`

const ast = parser(sql);
const regeneratedSQL = generate(ast);

console.log(format(regeneratedSQL));

⬆️

Credits

jdrew1303

Copyright (c) 2016

Issues

  • Tests, tests and more tests.
  • Documentation currently under construction (The examples need to be worked through for SQL instead of JavaScript).
  • AST is currently in a state of flux for some node types. We also probably need a builder for these nodes (another project).
  • You need to pass in ast.statement and not just the raw ast given back from the parser (This is an issue with the base node not having a type).
  • Adding support for comments.
  • Adding support for source-maps.

⬆️

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].