About this project
SQLGlot provides a dependency‑free SQL parser that can read a wide variety of SQL inputs and generate syntactically and semantically correct SQL in target dialects. It includes a transpiler for converting queries between dialects such as DuckDB, Presto/Trino, Spark/Databricks, Snowflake, BigQuery, and many others. The library offers an optimizer that rewrites queries into a canonical AST, utilities for AST introspection, diffing, and programmatic building or modification of SQL expressions. Users can extract metadata like columns and tables, detect syntax errors with detailed error messages, and handle unsupported features via configurable warning or error levels. SQLGlot also includes a lightweight executor for evaluating SQL against Python dictionaries, useful for testing and prototyping. Custom dialects can be added by subclassing the Dialect class, and plugin dialects can be distributed via entry points. Performance benchmarks show the pure‑Python version is competitive, while the mypyc‑compiled variant offers roughly 3‑5× speed improvements. The project is used by tools such as SQLMesh, Apache Superset, Dagster, Ibis, and dlt, and provides extensive documentation, a test suite, and optional dependencies like dateutil for interval simplification.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.