/sql

A Modern SQL frontend based on SQL16 with extensions for streaming, graph, rich types, etc, including parser, resolver, rewriters, etc.

Primary LanguageJavaApache License 2.0Apache-2.0

Java SQL:2016 Language Frontend

Visit our Website.

Build Status Maven Central Javadocs

A Modern SQL frontend based on the SQL16 Standard with extensions for streaming, graph, rich types.

* Comprehensive support for statements:

	- QUERY: ``SELECT ...``
	- DML: ``INSERT ... INTO ...`` ``UPDATE ...`` ``MERGE ... INTO ...`` ``DELETE ... FROM ...``
	- DDL: ``CREATE ...`` ``ALTER ...`` ``DROP ...``

* Nested Expressions (e.g. Sub-Selects)
* ``WITH`` clauses
* De-Parser for a Statement AST Node, which writes a SQL from Java Objects
* Rewriter
* Linter

How to use it

  1. Maven Repository

    <dependency>
    		<groupId>com.facebook.presto</groupId>
    		<artifactId>presto-coresql</artifactId>
    		<version>0.1</version>
    </dependency>
  2. Parsing and Unparsing a SQL Statement

    import com.facebook.coresql.parser.AstNode;
    import com.facebook.coresql.parser.ParserHelper;
    import com.facebook.coresql.parser.Unparser;
    
    String sqlStr = "select 1 from dual where a=b";
    AstNode ast = ParserHelper.parseStatement(sqlStr);
    String unparsedSqlStr = Unparser.unparse(ast);
  3. Compile latest version from source

    git clone https://github.com/kaikalur/sql.git
    cd sql
    mvn install