acryl-sqlglot
An easily customizable SQL parser and transpiler
What it is and what it does
acryl-sqlglot is a pure-Python SQL parser and transpiler that reads SQL in one dialect and outputs it in another. It supports 23 different SQL dialects including DuckDB, Presto, Trino, Spark, Databricks, Snowflake, and BigQuery. The package can format SQL, translate between dialects, optimize queries, analyze metadata (find columns and tables), build SQL programmatically, and traverse abstract syntax trees. It includes a comprehensive test suite and is performant despite being written entirely in Python.
The parser is designed to be forgiving rather than strict—it aims to read a wide variety of SQL inputs and output syntactically and semantically correct SQL in the target dialect, but does not aim to be a SQL validator and may not detect certain syntax errors. You can customize the parser, configure how it handles dialect incompatibilities (warn or raise), and inspect or modify parsed query trees. It preserves comments on a best-effort basis and handles identifier delimiters and data type translation across dialects.
Use it for:
- Translate SQL queries between database systems (e.g., convert Spark SQL to DuckDB or Snowflake syntax).
- Format and normalize SQL code across a codebase with consistent dialect rules and identifier handling.
- Extract metadata from queries—find all columns, tables, or projections referenced in a SELECT statement.
- Build or modify SQL queries programmatically by constructing and manipulating expression trees.
- Optimize SQL queries using the built-in optimizer before execution or deployment.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses, transpiles, and optimizes SQL across 23 different dialects without any runtime dependencies, enabling you to convert queries between systems like DuckDB, Presto, Spark, Snowflake, and BigQuery.
Yes. acryl-sqlglot is a mature, actively maintained tool with zero runtime dependencies, permissive licensing, and no known vulnerabilities. It solves a concrete problem—cross-dialect SQL translation—that is difficult to do correctly by hand. Install it if you need to work with SQL across multiple database systems or parse and analyze SQL programmatically.
Install
acryl-sqlglot on PyPI
pip
pip install acryl-sqlglotuv
uv add acryl-sqlglotpoetry
poetry add acryl-sqlglotInstalling acryl-sqlglot
Before you install
Installation is frictionless—the package has zero runtime dependencies and ships as a pure Python wheel. The project is actively maintained with recent commits and a large repository presence.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal obligations.
Quickstart
pip install acryl-sqlglot
import sqlglot
sqlglot.transpile("SELECT EPOCH_MS(1618088028295)", read="duckdb", write="hive")[0]
Verify before relying
- Whether the optional Rust tokenizer (via acryl-sqlglot[rs]) provides meaningful performance gains for typical workloads.
- Specific SQL validation limitations beyond what the description states about not being a validator.
- Performance characteristics and benchmarks for large-scale query parsing and transpilation.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 667 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 95,328/month — #13,270 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: acryl_sqlglot-25.25.2.dev9-py3-none-any.whl
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
sqlglotSQLGlot parses, transpiles, optimizes, and…
permissive · top 1,000 on PyPI
sqlglotrsA SQL parser, transpiler, and optimizer that…
permissive · top 5,000 on PyPI
sql-metadataParses SQL queries using sqlglot and extracts…
permissive · top 5,000 on PyPI
sqlglotcProvides mypyc-compiled C extensions that…
permissive · top 5,000 on PyPI
collate-sqlfluffSQLFluff is a SQL linter and auto-fixer that…
permissive · top 15,000 on PyPI
fugue-sql-antlrParses Fugue SQL dialect into an abstract…
permissive · top 5,000 on PyPI
collate-sqllineageAnalyzes SQL statements to extract source and…
permissive · top 5,000 on PyPI
sqlfluffSQLFluff is a SQL linter and auto-fixer that…
permissive · top 5,000 on PyPI
sqlfluff-templater-dbtEnables SQLFluff to lint and auto-fix dbt…
permissive · top 5,000 on PyPI
simple-ddl-parserParses SQL DDL statements and their dialect…
permissive · top 15,000 on PyPI