skillfed

acryl-sqlglot

An easily customizable SQL parser and transpiler

acryl-sqlglot v25.25.2.dev9 95.3K downloads/30d#13,270 on PyPI9,529
Permissive license MIT Active released

What it is and what it does

acryl-sqlglot is a pure-Python SQL parser and transpiler that reads SQL in one dialect and outputs it in another. It supports 23 different SQL dialects including DuckDB, Presto, Trino, Spark, Databricks, Snowflake, and BigQuery. The package can format SQL, translate between dialects, optimize queries, analyze metadata (find columns and tables), build SQL programmatically, and traverse abstract syntax trees. It includes a comprehensive test suite and is performant despite being written entirely in Python.

The parser is designed to be forgiving rather than strict—it aims to read a wide variety of SQL inputs and output syntactically and semantically correct SQL in the target dialect, but does not aim to be a SQL validator and may not detect certain syntax errors. You can customize the parser, configure how it handles dialect incompatibilities (warn or raise), and inspect or modify parsed query trees. It preserves comments on a best-effort basis and handles identifier delimiters and data type translation across dialects.

Use it for:

  • Translate SQL queries between database systems (e.g., convert Spark SQL to DuckDB or Snowflake syntax).
  • Format and normalize SQL code across a codebase with consistent dialect rules and identifier handling.
  • Extract metadata from queries—find all columns, tables, or projections referenced in a SELECT statement.
  • Build or modify SQL queries programmatically by constructing and manipulating expression trees.
  • Optimize SQL queries using the built-in optimizer before execution or deployment.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Parses, transpiles, and optimizes SQL across 23 different dialects without any runtime dependencies, enabling you to convert queries between systems like DuckDB, Presto, Spark, Snowflake, and BigQuery.

Yes. acryl-sqlglot is a mature, actively maintained tool with zero runtime dependencies, permissive licensing, and no known vulnerabilities. It solves a concrete problem—cross-dialect SQL translation—that is difficult to do correctly by hand. Install it if you need to work with SQL across multiple database systems or parse and analyze SQL programmatically.

Install

acryl-sqlglot on PyPI

pip

pip install acryl-sqlglot

uv

uv add acryl-sqlglot

poetry

poetry add acryl-sqlglot

Installing acryl-sqlglot

Before you install

Installation is frictionless—the package has zero runtime dependencies and ships as a pure Python wheel. The project is actively maintained with recent commits and a large repository presence.

License in practice

MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal obligations.

Quickstart

pip install acryl-sqlglot

import sqlglot
sqlglot.transpile("SELECT EPOCH_MS(1618088028295)", read="duckdb", write="hive")[0]

Verify before relying

  • Whether the optional Rust tokenizer (via acryl-sqlglot[rs]) provides meaningful performance gains for typical workloads.
  • Specific SQL validation limitations beyond what the description states about not being a validator.
  • Performance characteristics and benchmarks for large-scale query parsing and transpilation.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 667 days since the last release
Last repo commit
First released
Downloads 95,328/month — #13,270 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: acryl_sqlglot-25.25.2.dev9-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: SQL

Tags

sql parser transpilersql dialect convertersql query translatorcross-dialect sqlsql formatter optimizersql ast parsersql syntax analyzer
sql-transpilerquery-parsingdialect-conversion

More Database packages