Registry / database / sqlglotc

sqlglotc

JSON →
library30.17.0pypypi✓ verified 21d ago

sqlglotc provides performance-enhancing extensions for the sqlglot library, compiled using mypyc. SQLGlot is a robust, no-dependency Python library for parsing, transpiling, optimizing, and executing SQL across numerous dialects like DuckDB, Presto, Spark, Snowflake, and BigQuery. It aims to accurately process diverse SQL inputs and generate syntactically and semantically correct SQL in target dialects. The library is actively maintained with a rapid release cadence, currently at version 30.4.2.

pip install sqlglotc
INSTALL
IMPORT
SIG · SQLGLOTC
S
sqlglotc
databasepythonv30.17.0
Install
2.9s avg
Import
269ms
Disk
100MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
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
musl
glibc
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
py 3.9
1/2 runs
✓ 3.25s
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.
fix
Always 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.
fix
Always 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.
fix
Ensure 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.
fix
Use `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.
Agent activity
13 hits · last 30 days
node
10
OpenAI (training)
1
Resources
sqlglotc — pip install sqlglotc · libregistry