-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
pglast
PostgreSQL Languages AST and statements prettifier: master branch covers PG10, v2 branch covers PG12, v3 covers PG13, v4 covers PG14, v5 covers PG15, v6 covers PG16
-
pg_query
Ruby extension to parse, deparse and normalize SQL queries using the PostgreSQL query parser
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
pg_parse
PostgreSQL parser for Rust that uses the actual PostgreSQL server source to parse SQL queries and return the internal PostgreSQL parse tree.
-
mo-sql-parsing
Let's make a SQL parser so we can provide a familiar interface to non-sql datastores!
-
JSqlParser
JSqlParser parses an SQL statement and translate it into a hierarchy of Java classes. The generated hierarchy can be navigated using the Visitor Pattern
-
ANTLR
ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
Regular expressions is a popular approach to extract information from SQL statements. However, regular expressions quickly become too complex to handle common features like WITH, sub-queries, windows clauses, aliases and quotes. sqlparse is a popular python package that uses regular expressions to parse SQL.
Pingcap parser is a MySQL parser in Go.
SQL Parser in phpmyadmin is a validating SQL lexer and parser with a focus on MySQL dialect.
libpg_query extracts the parser (written in C) from the postgres project and packages it as a stand-alone library. This library is wrapped in other languages by other projects like:
Python: pglast
Ruby : pg_query
Golang: pg_query_go
Apache Calcite is a popular parser/optimizer that is used in popular databases and query engines like Apache Hive, BlazingSQL and many others.
JS: psql-parser in Node and pg-query-emscripten in the browser
JS: psql-parser in Node and pg-query-emscripten in the browser
Rust: pg_query.rs
queryparser implements Apache Hive, Presto/Trino and Vertica dialects.
zetasql implements BigQuery, Spanner, and Dataflow dialects.
Python: mo-sql-parseing
JSQLParser can parse multiple SQL dialects like MySQL, Postgres and Oracle. The grammar can be modified to support other SQL dialects.
There are multiple projects that maintain parsers for popular open source databases like MySQL and Postgres. For other open source databases, the grammar can be extracted from the open-source project. For commercial databases, the only option is to reverse engineer the complete grammar. There are SQL parser/optimizer platforms like Apache Calcite that help to reduce the effort to implement the SQL dialect of your choice.
An alternate approach is to implement the SQL grammar using parser generators like ANTLR. There are similar open source parser generators in other popular languages.