sqlglotrs
Deprecated: use sqlglotc instead
What it is and what it does
sqlglotrs is a SQL parser and transpiler that reads SQL in one dialect and outputs it in another, supporting over 30 database and query engine dialects. It parses SQL into an abstract syntax tree (AST), allowing you to analyze queries, extract metadata, detect syntax errors, and programmatically build or modify SQL. The package is written entirely in Python with no external dependencies, making it easy to integrate into any application.
Common use cases include translating queries between incompatible SQL dialects, formatting and normalizing SQL for consistency, and analyzing query structure. It can handle identifier delimiters and data type translation across dialects. The parser is intentionally lenient to accept a wide variety of SQL inputs, though it prioritizes semantic correctness over preserving cosmetic details like original formatting or casing.
Use it for:
- Translate SQL queries between incompatible dialects for cross-platform compatibility.
- Format and normalize SQL code for consistency and readability across a codebase.
- Extract metadata from queries—find all columns, tables, and functions referenced in a SQL statement.
- Detect and report SQL syntax errors such as unbalanced parentheses or incorrect keyword usage.
- Build or modify SQL queries programmatically by constructing and manipulating the AST.
- Optimize SQL queries by analyzing and rewriting expressions for better performance.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A SQL parser, transpiler, and optimizer that converts SQL between over 30 dialects with no runtime dependencies.
Yes, if you need to parse or translate SQL across multiple dialects. The package is actively maintained, has no runtime dependencies, and offers both pure Python and faster mypyc-compiled variants. However, the package summary marks it as deprecated in favor of sqlglotc—verify whether that migration is necessary for your use case before committing.
Install
sqlglotrs on PyPI
pip
pip install sqlglotrsuv
uv add sqlglotrspoetry
poetry add sqlglotrsInstalling sqlglotrs
Before you install
Installation is straightforward with low friction—a pure Python wheel with no runtime dependencies. The package is actively maintained; a mypyc-compiled variant is available for roughly 3-5x faster performance if needed.
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute it freely in both open-source and commercial projects without restriction.
Quickstart
pip install sqlglotrs
import sqlglotrs
result = sqlglotrs.transpile("SELECT EPOCH_MS(1618088028295)", read="duckdb", write="hive")[0]
print(result)
Requires Python 3.9 or later; custom dialects may not work properly with the mypyc-compiled variant and may require the pure Python version.
Verify before relying
- Whether sqlglotrs is actively maintained separately or if users should migrate to sqlglotc as indicated in the summary.
- Performance characteristics of the mypyc-compiled variant on different platforms.
- Completeness of dialect support for less common SQL dialects or edge cases in real-world queries.
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 — 172 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,900,289/month — #2,206 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sqlglotrs-0.13.0-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
acryl-sqlglotParses, transpiles, and optimizes SQL across 23…
permissive · top 15,000 on PyPI
sqlglotSQLGlot parses, transpiles, optimizes, and…
permissive · top 1,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
fugue-sql-antlrParses Fugue SQL dialect into an abstract…
permissive · top 5,000 on PyPI
sqloxidesqloxide parses SQL queries into a typed…
permissive · top 15,000 on PyPI
collate-sqlfluffSQLFluff is a SQL linter and auto-fixer that…
permissive · top 15,000 on PyPI
shandy-sqlfmtA command-line SQL formatter that automatically…
permissive · top 5,000 on PyPI
sqlfluffSQLFluff is a SQL linter and auto-fixer that…
permissive · top 5,000 on PyPI
sqllineageSQLLineage parses SQL statements to extract and…
permissive · top 5,000 on PyPI