sqlglot
An easily customizable SQL parser and transpiler
Decision gist · record as of 2026-08-14
Yes. SQLGlot is actively maintained, has zero known vulnerabilities, installs with no dependencies, and solves a concrete problem—SQL dialect translation and analysis—that is difficult to handle manually. It is suitable for production use in data pipelines, ETL tools, and query analysis systems. The only caveat is that custom dialect subclasses may not work reliably with the mypyc-compiled variant, so verify compatibility if you plan to extend it.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Installation is straightforward with no runtime dependencies.
- The package is actively maintained with a release just 2 days ago and has 9526 GitHub stars.
License · maintenance · safety
MIT (permissive) — Licensed under MIT (permissive), so you can use, modify, and distribute SQLGlot freely in commercial and private projects with minimal restrictions.
last release 2026-08-12 (2 days) · last repo commit 2026-08-14 · 9,526 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 83,483,497 downloads/mo, #402 on PyPI
Alternatives
Verify before relying
pip install sqlglot
import sqlglot
# Transpile from one dialect to another
result = sqlglot.transpile("SELECT EPOCH_MS(1618088028295)", read="duckdb", write="hive")[0]
print(result)- Whether the mypyc-compiled version (`sqlglot[c]`) is available as a prebuilt wheel for your platform or requires compilation from source.
- Performance characteristics and memory footprint for very large SQL files or deeply nested queries.
- Compatibility of custom dialect subclasses with the mypyc-compiled variant, as the documentation notes potential issues.
What it is and what it does
SQLGlot is a pure-Python SQL parser and transpiler that converts SQL queries between over 30 dialects—including DuckDB, Presto, Spark, Snowflake, and BigQuery—while preserving semantic meaning. It reads SQL in one dialect and outputs syntactically correct SQL in another, handling dialect-specific differences in functions, data types, and identifier delimiters. Beyond transpilation, it can parse queries into an abstract syntax tree (AST) for programmatic analysis, extract metadata like column and table references, detect syntax errors, and optimize queries.
The package has no external runtime dependencies and is written entirely in Python, making it simple to install and integrate. It includes a comprehensive test suite and optional mypyc compilation for performance. You can customize the parser, build SQL programmatically, and traverse expression trees. The parser is intentionally lenient to accept a wide variety of SQL inputs, though it does not validate whether queries will execute successfully—it transpiles rather than validates.
Use it for
- Translate SQL queries between database systems (e.g., Spark to DuckDB) to support multi-platform data pipelines.
- Format and normalize SQL for consistency, with optional pretty-printing and identifier quoting across dialects.
- Extract metadata from queries—find all columns, tables, and joins—for data lineage or dependency analysis.
- Build or modify SQL programmatically by constructing and manipulating AST nodes instead of string concatenation.
- Detect and report SQL syntax errors like unbalanced parentheses or invalid keyword usage.
- Optimize SQL queries by analyzing and transforming the AST before generating output.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
SQLGlot is actively maintained, has zero known vulnerabilities, installs with no dependencies, and solves a concrete problem—SQL dialect translation and analysis—that is difficult to handle manually. It is suitable for production use in data pipelines, ETL tools, and query analysis systems. The only caveat is that custom dialect subclasses may not work reliably with the mypyc-compiled variant, so verify compatibility if you plan to extend it.
Install
sqlglot on PyPI
Before you install
Installation is straightforward with no runtime dependencies. The package is actively maintained with a release just 2 days ago and has 9526 GitHub stars. A mypyc-compiled variant is available via `sqlglot[c]` for roughly 3-5x faster performance if needed.
Requires Python 3.9 or later.
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute SQLGlot freely in commercial and private projects with minimal restrictions.
Quickstart
pip install sqlglot
import sqlglot
# Transpile from one dialect to another
result = sqlglot.transpile("SELECT EPOCH_MS(1618088028295)", read="duckdb", write="hive")[0]
print(result)
Verify before relying
- Whether the mypyc-compiled version (`sqlglot[c]`) is available as a prebuilt wheel for your platform or requires compilation from source.
- Performance characteristics and memory footprint for very large SQL files or deeply nested queries.
- Compatibility of custom dialect subclasses with the mypyc-compiled variant, as the documentation notes potential issues.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 2 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 83,483,497 / month, #402 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: SQL |
Evidence: sqlglot-30.17.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “convert sql between dialects”
- sqlglotSQLGlot parses, transpiles, optimizes, and analyzes SQL across over…
- acryl-sqlglotParses, transpiles, and optimizes SQL across 23 different dialects…
- databricks-labs-remorphConverts SQL code between different database dialects and reconciles…
Give your agent the search over MCP, or paste the wish link into any chat.
More Database packages
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.
Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.
YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.
Install it if you need to connect Python applications to YDB databases.
Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.
sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.
Install it if you need to manipulate, format, or analyze SQL text programmatically.
Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.
See also acryl-sqlglot · fugue-sql-antlr · sql-metadata · sqlglotc · sqlglotrs · sqloxide · sqllineage · shandy-sqlfmt · collate-sqlfluff · sqlfluff-templater-dbt