You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A huge thank you to our sponsor, [Starlake.ai](https://starlake.ai/) who simplifies data ingestion, transformation, and orchestration, enabling faster delivery of high-quality data. Starlake has been instrumental in providing Piped SQL and numerous test cases for BigQuery, Redshift, DataBricks, and DuckDB. Show your support for ongoing development by visiting Starlake.ai and giving us a star!
10
+
10
11
## Summary
11
12
12
-
Please visit the[WebSite](https://jsqlparser.github.io/JSqlParser). **JSqlParser** is a RDBMS agnostic SQL statement parser. It translates SQL statements into a traversable hierarchy of Java classes (see [Samples](https://jsqlparser.github.io/JSqlParser/usage.html#parse-a-sql-statements)):
13
+
Please visit our[WebSite](https://jsqlparser.github.io/JSqlParser) for detailed information. **JSqlParser** is a RDBMS agnostic SQL statement parser. It translates SQL statements into a traversable hierarchy of Java classes (see [Samples](https://jsqlparser.github.io/JSqlParser/usage.html#parse-a-sql-statements)):
13
14
14
15
```sql
15
16
SELECT1FROM dual WHERE a = b
16
-
```
17
17
18
-
```text
18
+
/* produces the following AST
19
+
19
20
SQL Text
20
21
└─Statements: statement.select.PlainSelect
21
22
├─selectItems: statement.select.SelectItem
@@ -24,6 +25,7 @@ SQL Text
24
25
└─where: expression.operators.relational.EqualsTo
25
26
├─Column: a
26
27
└─Column: b
28
+
*/
27
29
```
28
30
29
31
```java
@@ -45,19 +47,35 @@ Column a = (Column) equalsTo.getLeftExpression();
45
47
Column b = (Column) equalsTo.getRightExpression();
46
48
Assertions.assertEquals("a", a.getColumnName());
47
49
Assertions.assertEquals("b", b.getColumnName());
48
-
}
49
50
```
51
+
## Support for `Piped SQL`
52
+
53
+
Work is progressing for parsing `Piped SQL`, a much saner and more logical way to write queries in its semantic order.
54
+
```sql
55
+
FROM Produce
56
+
|>WHERE
57
+
item !='bananas'
58
+
AND category IN ('fruit', 'nut')
59
+
|> AGGREGATE COUNT(*) AS num_items, SUM(sales) AS total_sales
60
+
GROUP BY item
61
+
|>ORDER BY item DESC;
62
+
```
63
+
64
+
For details, please see https://storage.googleapis.com/gweb-research2023-media/pubtools/1004848.pdf, https://cloud.google.com/bigquery/docs/reference/standard-sql/pipe-syntax and https://duckdb.org/docs/sql/query_syntax/from.html#from-first-syntax
65
+
66
+
## Java Version
50
67
51
-
JSQLParser-4.9 was the last JDK8 compatible version. The recent JSQLParser-5.0 depends on JDK11 and introduces API breaking changes to the AST Visitors. Please see the Migration Guide for the details.
68
+
JSQLParser-4.9 was the last JDK8 compatible version. JSQLParser-5.0 and later depend on JDK11 and introduce API breaking changes to the AST Visitors. Please see the Migration Guide for the details.
52
69
53
70
## [Supported Grammar and Syntax](https://jsqlparser.github.io/JSqlParser/syntax.html)
54
71
55
72
**JSqlParser** aims to support the SQL standard as well as all major RDBMS. Any missing syntax or features can be added on demand.
| Oracle<br>MS SQL Server and Sybase<br>Postgres<br>MySQL and MariaDB<br>DB2<br>H2 and HSQLDB and Derby<br>SQLite |`SELECT`<br>`INSERT`, `UPDATE`, `UPSERT`, `MERGE`<br>`DELETE`, `TRUNCATE TABLE`<br>`CREATE ...`, `ALTER ....`, `DROP ...`<br>`WITH ...`|
| Oracle<br>MS SQL Server and Sybase<br>Postgres<br>MySQL and MariaDB<br>DB2<br>H2 and HSQLDB and Derby<br>SQLite |`SELECT`<br>`INSERT`, `UPDATE`, `UPSERT`, `MERGE`<br>`DELETE`, `TRUNCATE TABLE`<br>`CREATE ...`, `ALTER ....`, `DROP ...`<br>`WITH ...`|
77
+
| Salesforce SOQL |`INCLUDES`, `EXCLUDES`|
78
+
| Piped SQL (also known as FROM SQL) ||
61
79
62
80
**JSqlParser** can also be used to create SQL Statements from Java Code with a fluent API (see [Samples](https://jsqlparser.github.io/JSqlParser/usage.html#build-a-sql-statements)).
63
81
@@ -67,12 +85,12 @@ If you like JSqlParser then please check out its related projects:
67
85
68
86
*[JSQLFormatter](https://manticore-projects.com/JSQLFormatter/index.html) for pretty printing and formatting SQL Text
69
87
70
-
*[JSQLTranspiler](https://manticore-projects.com/JSQLTranspiler/index.html) for dialect specific rewriting, SQL Column resolution and Lineage
88
+
*[JSQLTranspiler](https://manticore-projects.com/JSQLTranspiler/index.html) for dialect specific rewriting, SQL Column resolution and Lineage, provided by [Starlake.ai](https://starlake.ai/)
71
89
72
90
## Alternatives to JSqlParser?
73
91
[**General SQL Parser**](http://www.sqlparser.com/features/introduce.php?utm_source=github-jsqlparser&utm_medium=text-general) looks pretty good, with extended SQL syntax (like PL/SQL and T-SQL) and java + .NET APIs. The tool is commercial (license available online), with a free download option.
74
92
75
-
Alternatively the dual-licensed [JOOQ](https://www.jooq.org/doc/latest/manual/sql-building/sql-parser/) provides a hand-written Parser supporting a lot of RDBMS, translation between dialects, SQL transformation, can be used as a JDBC proxy for translation and transformation purposes.
93
+
Alternatively the dual-licensed [JOOQ](https://www.jooq.org/doc/latest/manual/sql-building/sql-parser/) provides a handwritten Parser supporting a lot of RDBMS, translation between dialects, SQL transformation, can be used as a JDBC proxy for translation and transformation purposes.
0 commit comments