Install & Compatibility
Where this runs
tested against v30.17.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.10
✕ build_error
✓ 2.9s
py 3.11
✕ build_error
✓ 2.9s
py 3.12
✕ build_error
✓ 2.75s
py 3.13
✕ build_error
✓ 2.7s
100MB installed
● package 100MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
transpile
✓ from sqlglot import transpile
sqlglotc enhances sqlglot's performance transparently; users typically interact with sqlglot's API directly.
parse_one
✓ from sqlglot import parse_one
sqlglotc enhances sqlglot's performance transparently; users typically interact with sqlglot's API directly.
This quickstart demonstrates how to use the core `sqlglot` functionalities, `transpile` and `parse_one`, which are transparently accelerated by `sqlglotc` if installed. It shows converting a simple SQL query between dialects and parsing a query into an abstract syntax tree.
import sqlglot
# Example: Transpile SQL from DuckDB to Hive dialect
duckdb_sql = "SELECT EPOCH_MS(1618088028295)"
hive_sql = sqlglot.transpile(duckdb_sql, read='duckdb', write='hive')[0]
print(f"Original DuckDB SQL: {duckdb_sql}")
print(f"Transpiled Hive SQL: {hive_sql}")
# Example: Parse a SQL query into an expression tree
expression = sqlglot.parse_one("SELECT id, name FROM users WHERE age > 18")
print(f"Parsed Expression: {expression}")
Debug
Known issues
breakingMinor version updates of `sqlglot` (and thus `sqlglotc`) can introduce backwards-incompatible changes in SQL parsing or transpilation logic, especially concerning specific dialect behaviors.fixAlways pin `sqlglot` (and `sqlglotc`) to specific versions in production. Test upgrades thoroughly before deploying. Consult the `sqlglot` release notes for details on changes between versions.
affects: All versions, particularly across minor increments (e.g., X.Y.Z to X.Y+1.Z)
gotchaFailing to explicitly specify the source (`read`) and target (`write`) SQL dialects when using `sqlglot.transpile` or `sqlglot.parse_one` can lead to incorrect parsing or output. `sqlglot` defaults to its 'SQLGlot dialect' if not specified.fixAlways provide the `read` and `write` (or `dialect` for `parse_one`) arguments to ensure correct interpretation and generation of SQL for your specific dialect.
affects: All versions
gotchaIf pre-built wheels for `sqlglotc` are not available for your specific platform or Python version, installation will attempt to build from source. This requires `mypyc` and a compatible C compiler (e.g., GCC or Clang) to be present on your system.fixEnsure you have a C compiler and the `mypyc` package installed (e.g., `pip install mypyc`) if encountering build errors during `sqlglotc` installation.
affects: All versions without pre-built wheels
gotcha`sqlglot` primarily acts as a parser, transpiler, and optimizer, not a full SQL validator. While it detects many syntax errors, it may not catch all semantic or dialect-specific validation issues.fixUse `sqlglot` for transformation and analysis, but do not rely on it as a comprehensive SQL validator for all possible error conditions. Supplement with actual database execution or dedicated linting/validation tools.
affects: All versions
Upgrade
Version history
30.17.0latest on PyPI · released Aug 12, 2026
Audit
Dependencies
sqlglotrequiredsqlglotc provides compiled extensions for sqlglot, making sqlglot a core dependency for its functionality.