# tobymao/sqlglot

Python SQL Parser and Transpiler

Repository: https://github.com/tobymao/sqlglot
Canonical: https://ross.abutalabs.com/products/sqlglot
Homepage: https://sqlglot.com/
Language: Python
License: MIT
License Family: permissive
Topics: transpiler, sql, python, parser, optimizer, bigquery, duckdb, hive, mysql, postgres, presto, snowflake, spark, sqlite, sqlparser, trino, tsql, clickhouse, redshift, databricks
Last push: 2026-08-26T18:57:51+00:00

## Health v2 (maintenance only)
Score: 77/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 35, longevity 100
- inputs: {"age_days": 1999, "days_push": 7, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 9569, forks 1263 (observed 2026-08-28T04:10:32.048391+00:00)

## What it is
SQLGlot is a dependency-free Python SQL parser, transpiler, optimizer, and execution engine supporting 30+ SQL dialects such as DuckDB, Snowflake, BigQuery, and Spark. It enables formatting, translating, analyzing, and programmatically building SQL via expression trees.

## Use cases
- translate SQL between dialects like Snowflake and BigQuery
- format and pretty-print SQL queries
- parse SQL into an AST for analysis
- detect SQL syntax errors and dialect incompatibilities
- programmatically build or modify SQL queries
- optimize SQL queries
- execute SQL with a pure-Python engine

## When to choose
- you need dialect-agnostic SQL parsing or translation in Python
- you want a zero-dependency, pure-Python SQL tool
- you need to analyze, lint, or rewrite SQL programmatically

## When to avoid
- you need a full production database engine rather than parsing/transpiling
- you need a non-Python runtime

## Facets
- artifact type: library
- maturity: stable
- function: parser, compiler, developer-tools
- domain: databases, parsers, developer-tools
- platform: python, cross-platform
- tags: sql, transpiler, sql-dialects, ast, query-optimization, sql-formatting, query-engine, data-engineering

## Member repositories
- tobymao/sqlglot (main) score 77

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:10:32.048391+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:21:55.964358+00:00, confidence not recorded.
  - readme: https://github.com/tobymao/sqlglot (fetched 2026-08-28T04:10:32.048391+00:00, sha 2e9ce69d8caf)
  - homepage: https://sqlglot.com/ (fetched 2026-08-29T08:21:28.304966+00:00, sha 44136fa355b3)
- Data as of 2026-08-30T08:39:29.467469+00:00.
