JSqlParser: A Java AST for SQL, with Faster Manticore Builds and a Dialect Catch-All
JSqlParser parses an SQL statement and translate it into a hierarchy of Java classes. The generated hierarchy can be navigated using the Visitor Pattern.
At a glance
- What is it?
- JSqlParser turns SQL into a traversable Java object tree and back. The current development line is a major speedup over 5.3, and the README's own install advice points at the Manticore builds, not the upstream artifact.
- Who is it for?
- Adopt JSqlParser if you need a Java-friendly SQL AST for parsing, rewriting, or generating SQL across many dialects, and you can tolerate the grammar's 'add on demand' approach to new syntax. Do not adopt it if you need a stable, vendor-certified parser for a single dialect.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository received new commits within the last day.
- What is it written in?
- Mainly Java, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 14, 2026, and from our analysis. They are not legal advice.
Star history
- JSQLParser/JSqlParser5,978 ★ · +22
| Repository | 2026-07-28 | 2026-11-14 |
|---|---|---|
| JSQLParser/JSqlParser | 6k | 6k |
22 Stars in the last 109 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What JSqlParser Solves and Who Needs It
JSqlParser addresses a recurring problem for Java developers: turning SQL text into a structured object model that can be inspected, modified, and rendered back as SQL. The README's example shows a simple SELECT becoming a PlainSelect object with getters for select items, the FROM table, and the WHERE clause. This is useful for tooling that must understand SQL without executing it: query analyzers, schema diff tools, data lineage systems, or any application that needs to rewrite user-supplied SQL. The intended audience is JVM developers building such tools, not database drivers or query engines. The parser is RDBMS-agnostic, aiming to cover the SQL standard plus a dozen dialects, which is a different niche than a database-specific parser that guarantees exact syntax support. If your project only needs to parse one dialect and you rarely see new syntax, a hand-written parser might be simpler, but JSqlParser's value is in breadth: one grammar for BigQuery, Snowflake, DuckDB, Redshift, Oracle, SQL Server, PostgreSQL, MySQL, and others. The README claims it handles nested sub-selects, bind parameters, window and analytic functions, and Oracle hints. That breadth is the core selling point, and it is also the source of its main weakness, which we will get to.
The Visitor Pattern and the Object Model
The parser's output is a hierarchy of Java classes that you navigate with the Visitor pattern. The README's tree diagram shows a SELECT statement with select items, a table, and a where clause, each represented by a distinct class like LongValue, Table, and EqualsTo. This is not a generic map or a list of tokens; it is a typed AST. The same object model works in reverse: you can build statements using a fluent API and render them as SQL text. That bidirectional capability is important. It means you can parse a query, modify the AST nodes, and print the result, which is the foundation for SQL rewriting tools. The visitor pattern is a deliberate choice: it lets you write traversal logic without scattering switch statements over every node type. However, it also means that adding a new SQL construct requires adding new visitor methods, which is a breaking change. If you maintain a tool that depends on a specific visitor interface, upgrading JSqlParser can be a significant effort. The object model is the heart of the library, and its design is a trade-off between type safety and evolvability.
Getting It Running: Two Coordinate Sets and a Version Range
Installing JSqlParser is straightforward, but the README introduces a confusing twist. The recommended dependency uses the Manticore group ID: com.manticore-projects.jsqlformatter:jsqlparser with a version range of [5.3.218,). The README calls these 'stable Manticore builds' and says they are released continuously from the current development line, carrying all the performance and grammar work. In contrast, the upstream artifact is com.github.jsqlparser:jsqlparser version 5.3, which the README describes as 'considerably older' and only hides behind a collapsible details tag. This is a significant decision point for adopters. If you follow the README, you are not using the upstream release; you are using a build from the current development line that is published under a different group ID. That has implications for trust and maintenance. The Manticore build uses a version range, which in Maven is a floating dependency that can pick up new releases automatically. That is convenient but risky: you might get a new grammar change that breaks your parsing without a deliberate upgrade. The upstream version is a fixed 5.3.
Performance Claims and the Benchmark Caveat
The README makes a bold performance claim: the latest development line is 11 times faster than version 5.3, and it calls JSqlParser 'the fastest parser on real-world SQL of any of the parsers tested, in any language.' The benchmark table shows 21.138 ms/op for the latest version versus 983.459 ms/op for 5.3. Those numbers come from a separate repository, jsqlparser-bench, which the README links to. I have not run those benchmarks, and the README does not describe the hardware or the exact methodology beyond saying it runs on JSqlParser's own SELECT test suite and compares against SQLGlot, sqlglot[c], and polyglot-sql. The claim that it is faster than any parser in any language is extraordinary and should be treated with skepticism until you reproduce it on your own workload. The 11x improvement over 5.3 is plausible if the development line includes significant grammar optimizations, but the README does not explain what changed. For an adopter, the practical takeaway is this: if you are currently on 5.3 and you care about parse throughput, the Manticore build might be worth trying, but you should benchmark it against your own SQL patterns. The benchmark suite is public, so you can inspect it. Performance is a real factor for batch processing of large query logs.
Dialect Coverage and the 'Add on Demand' Grammar
JSqlParser's grammar is a single grammar that attempts to cover the SQL standard plus all major RDBMS dialects. The README lists fifteen dialects, from BigQuery to SQLite, and a statement table that includes SELECT, DML, DDL, PostgreSQL row-level security, and even Salesforce SOQL. That is an ambitious scope. The README explicitly says 'missing syntax gets added on demand' and points to the issue tracker. This is a double-edged sword. On the positive side, it means the parser is actively evolving and you can request support for a specific syntax. On the negative side, it means there is no guarantee that your dialect's obscure feature is covered out of the box. For example, Oracle hints are mentioned, but that does not mean every variant is supported. The 'one grammar' approach also creates ambiguity problems. For a tool that must parse arbitrary user SQL, this is a real risk. If your application only handles a narrow set of SQL, you will be fine. If you need to parse complex Oracle PL/SQL or PostgreSQL-specific constructs, you should test extensively. The README's promise of 'one grammar, twelve dialects' is a marketing simplification; the reality is a grammar that is always catching up.
Piped SQL and the Direction of the Project
A notable entry is Piped SQL support: the README's statement table lists Piped SQL alongside SELECT and WITH under queries. This is a forward-looking addition, and it shows that the project is not just maintaining legacy dialect support but also tracking new SQL paradigms. For an adopter, this is a positive signal: the grammar is actively updated to handle new syntax. However, it also means the parser is in flux. The project's direction seems to be toward broader dialect coverage and modern syntax, which is good for a general-purpose tool.
Licensing, Maintenance, and Upgrade Cost
JSqlParser is licensed under Apache-2.0, which is permissive and allows commercial use without requiring you to open-source your code. That is a low-license-risk choice for most organizations. The project is not archived, and the last push was in October 2026, so it is actively maintained. The recent releases are 5.2 and 5.3 in May 2025 and 5.4 in September 2026. The maintenance cost is not trivial: you need to track releases, test your SQL corpus against each new version, and potentially adjust your code for API changes. The README also highlights the two sets of coordinates: the Manticore builds are the recommended ones and carry the performance and grammar work, while the upstream com.github.jsqlparser release is considerably older. Before adopting, check which artifact your build resolves and test your SQL against it. The Apache-2.0 license gives you the freedom to fork it yourself if needed, but that is a last resort.
Editorial conclusion
Adopt JSqlParser if you need a Java-friendly SQL AST for parsing, rewriting, or generating SQL across many dialects, and you can tolerate the grammar's 'add on demand' approach to new syntax. Do not adopt it if you need a stable, vendor-certified parser for a single dialect. Before committing, verify which artifact you actually depend on: the README pushes the Manticore builds (com.manticore-projects.jsqlformatter) for performance, while its upstream coordinates are com.github.jsqlparser 5.3. Test your specific SQL corpus against the parser's grammar, especially for T-SQL or Oracle syntax, because the single-grammar approach may not cover every edge case.
Frequently asked questions
What does JSqlParser do when it parses SQL?
It translates the statement into a hierarchy of Java classes, and the generated hierarchy is navigated with the Visitor pattern. The same object model works in reverse: statements can be built from Java through a fluent API and rendered back out as SQL text.
Is there a Python library that can parse SQL like JSqlParser does?
Not out of this repository. JSqlParser is a library for the JVM written in Java, consumed as a Maven or Gradle dependency, and its build is declared twice, in pom.xml and in build.gradle. No Python binding appears in the tree.
How do I add JSqlParser to a Maven build?
Use the coordinates the README prefers: group com.manticore-projects.jsqlformatter, artifact jsqlparser, version range [5.3.218,). Gradle callers put the same group and artifact in an implementation line with a plus sign instead of a version. The older upstream coordinates are com.github.jsqlparser:jsqlparser:5.3.
Does JSqlParser execute the SQL that it parses?
No. Parsing produces Java objects.
Which SQL dialects does JSqlParser parse?
The named list is BigQuery, Snowflake, DuckDB, Redshift, Oracle, MS SQL Server, Sybase, PostgreSQL, MySQL, MariaDB, DB2, H2, HSQLDB, Derby and SQLite, which is fifteen names, while the README header says twelve dialects. Some syntax still has to be opted into, such as Informix trailing constraint names through parser.withDialect(Dialect.INFORMIX).
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/jsqlparser-jsqlparser)Star history chart for your README
[](https://hysenlabs.com/projects/jsqlparser-jsqlparser)Was this useful?