--- id: sqlglotrs version: "0.13.0" license: MIT license_treatment: permissive maintenance: active --- # sqlglotrs — Deprecated: use sqlglotc instead License: permissive · Maintenance: active · Downloads: 4.9M/mo ## 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 above — 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 pip install sqlglotrs uv add sqlglotrs poetry add sqlglotrs ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 4.9M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags sql parser transpiler, sql dialect conversion, sql formatting and translation, cross-dialect sql, sql query optimizer, sql ast parser, multi-dialect sql support, sql-parsing, dialect-translation, query-optimization [View on SkillFed](https://skillfed.io/packages/sqlglotrs) · [View on PyPI](https://pypi.org/project/sqlglotrs/)