SQLGlot
Pure-Python SQL parser and transpiler that translates queries between 20+ dialects and rewrites, optimizes, and analyzes SQL.
SQLGlot
SQLGlot is a no-dependency Python SQL parser, transpiler, and optimizer. It reads SQL from one dialect and rewrites it into another — translating between DuckDB, Presto/Trino, Spark, Snowflake, BigQuery, Postgres, MySQL, and 20+ others — making it a workhorse for database migrations and cross-engine tooling. Because it builds a real AST, you can also format, optimize, and programmatically analyze queries.
Key features
- Transpile SQL across 20+ dialects with a single call
- Full AST for parsing, rewriting, and query optimization
- Column-level lineage and metadata analysis
- Diff two queries semantically (AST-aware, not text diff)
- Zero runtime dependencies; embeddable in pipelines and agents
Indispensable for teams moving warehouses, building dialect-portable query layers, or giving an LLM agent a deterministic way to validate and rewrite generated SQL.
Curated mirror of the open-source SQLGlot (MIT). Get it from the source.
Compromise signals — malicious or tampered code (leaked secrets, backdoors, a dropped executable) — reduce the score, and known dependency CVEs carry a bounded penalty (they warrant review but never QUARANTINE — update the dependency to clear). Other dangerous-by-capability traits are risk surface, expected for some capabilities. Every finding is mapped to its OWASP control below.
Findings mapped to the OWASP Top 10 for LLM Applications (2025) and the OWASP Machine Learning Security Top 10. Expand any flagged control for the exact findings — compromise reduces the score; expected/risk-surface do not, except a known CVE, which carries a small bounded penalty (high/critical → Review).
The same gate an agent runs before installing (POST /api/v1/trust/sqlglot-sql-transpiler/check). Click a policy:
Consume SQLGlot programmatically. Authenticate with an API key or session — see Authorize an agent.
# Agents: CHECK BEFORE YOU INSTALL (no auth) — score, grade, level, capability manifest
curl https://ai-supply.store/api/v1/trust/sqlglot-sql-transpiler
# Gate against your org policy (returns { pass, violations })
curl -X POST https://ai-supply.store/api/v1/trust/sqlglot-sql-transpiler/check \
-H "Content-Type: application/json" \
-d '{"minGrade":"B","denyPermissions":["shell"],"denyUnknownEgress":true}'
# CLI
npx ai-supply add sqlglot-sql-transpiler
# REST (install → download)
curl -X POST https://ai-supply.store/api/v1/listings/sqlglot-sql-transpiler/install \
-H "Authorization: Bearer $AIM_KEY"
# MCP tool
install_listing({ "slug": "sqlglot-sql-transpiler" })OpenAPI spec →Curated mirror — latest upstream source. See the repository for tagged releases.