back to home

tobilg / polyglot

Rust/Wasm-powered SQL transpiler for more than 30 SQL dialects

725 stars
38 forks
7 issues
RustTypeScriptPython

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing tobilg/polyglot in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/tobilg/polyglot)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

Polyglot Rust/Wasm-powered SQL transpiler for 32+ dialects, inspired by sqlglot. Polyglot parses, generates, transpiles, and formats SQL across 32+ database dialects. It ships as: • a Rust crate ( ) • a TypeScript/WASM SDK ( ) • a Python package ( ) There's also a playground where you can try it out in the browser, as well as Rust API Docs, TypeScript API Docs, and Python API Docs. Release notes are tracked in . Features • **Transpile** SQL between any pair of 32 dialects • **Parse** SQL into a fully-typed AST • **Generate** SQL back from AST nodes • **Format** / pretty-print SQL • **Fluent builder API** for constructing queries programmatically • **Validation** with syntax, semantic, and schema-aware checks • **AST visitor** utilities for walking, transforming, and analyzing queries • **C FFI** shared/static library for multi-language bindings ( ) • **Python bindings** powered by PyO3 ( on PyPI) Supported Dialects (32) | | | | | | |---|---|---|---|---| | Athena | BigQuery | ClickHouse | CockroachDB | Databricks | | Doris | Dremio | Drill | Druid | DuckDB | | Dune | Exasol | Fabric | Hive | Materialize | | MySQL | Oracle | PostgreSQL | Presto | Redshift | | RisingWave | SingleStore | Snowflake | Solr | Spark | | SQLite | StarRocks | Tableau | Teradata | TiDB | | Trino | TSQL | | | | Quick Start Rust See the full Rust crate README for more examples. TypeScript See the full TypeScript SDK README for more examples. Python See the full Python bindings README. Format Guard Rails SQL formatting runs through guard limits in Rust core to prevent pathological inputs from exhausting memory: • : (default) • : (default) • : (default) • : (default) Guard failures return error codes in the message ( , , , ). Configuration surface by runtime: • Rust: configurable via . • WASM: configurable via / . • TypeScript SDK: configurable via . • C FFI: configurable via . • Python: configurable via keyword-only overrides. WASM low-level example (from exports): Project Structure Examples Standalone example projects are available in the directory. Each one pulls the latest published package and can be run independently. Rust TypeScript Building from Source C FFI Polyglot provides a stable C ABI in . • Crate README: • Generated header: • Example program: • Make targets: • - • - For tagged releases ( ), CI also attaches prebuilt FFI artifacts and checksums to GitHub Releases. Python Bindings Polyglot provides first-party Python bindings in . • Crate README: • Package name on PyPI: • Make targets: • - • - Function Catalogs Optional dialect function catalogs are provided via . • Crate README: • Core feature flags: • - • • Intended behavior: compile-time inclusion, one-time load in core, auto-use during schema validation type checks. Testing Polyglot currently runs **10,220 SQLGlot fixture cases** plus additional project-specific suites. All strict pass/fail suites are at **100%** in the latest verification run. | Category | Count | Pass Rate | |----------|------:|:---------:| | SQLGlot generic identity | 956 | 100% | | SQLGlot dialect identity | 3,554 | 100% | | SQLGlot transpilation | 5,513 | 100% | | SQLGlot transpile (generic) | 145 | 100% | | SQLGlot parser | 29 | 100% | | SQLGlot pretty-print | 23 | 100% | | Lib unit tests | 835 | 100% | | Custom dialect identity | 276 | 100% | | Custom dialect transpilation | 347 | 100% | | ClickHouse parser corpus (non-skipped) | 7,047 | 100% | | FFI integration tests | 20 | 100% | | Python bindings tests ( ) | 69 | 100% | | **Total (strict Rust/FFI pass/fail case count)** | **18,745** | **100%** | Benchmarks Fuzzing Makefile Targets | Target | Description | |--------|-------------| | | Show all available commands | | | Build core release + FFI + Python + bindings + WASM/SDK | | | Build WASM package + TypeScript SDK | | | Build C FFI crate ( profile) | | | Generate C header via cbindgen/build.rs | | | Build + run C example against FFI lib | | | Build/install Python extension in uv-managed env | | | Build Python wheels with maturin | | | Run FFI integration tests | | | Run SQLGlot-named Rust tests in | | | Run all 10,220 SQLGlot fixture cases | | | Run 835 lib unit tests | | | Full verification suite | | | Run strict ClickHouse parser suite | | | Run ClickHouse coverage suite (report-only) | | | Compare against Python sqlglot | | | Performance comparison | | | Run bench and generate Markdown report | | | Core parse benchmark (polyglot vs sqlglot) | | | Faster core parse benchmark mode | | | Parse benchmark including optional parsers | | | Regenerate JSON fixtures from Python | | | Create fixture symlink for Rust tests | | | Generate TypeScript type bindings | | | Run Python bindings tests | | | Run Python bindings type-check | | | Build documentation site | | | Deploy documentation to Cloudflare Pages | | | Build Python API docs site | | | Deploy Python API docs to Cloudflare Pages | | | Build playground | | | Deploy playground to Cloudflare Pages | | | Remove all build artifacts | Rust Parsing Markdown Report For a release-note friendly summary of the pure Rust parse benchmark ( , , , ), run: This will: • run • read Criterion results from • generate with a Markdown table (mean, std dev, 95% CI, baseline delta if available) Latest generated result snapshot: • Generated: 2026-02-26 13:43:10 UTC • Source: | Query | Mean | Std Dev | 95% CI (mean) | Change vs baseline | |---|---:|---:|---:|---:| | short | 51.28 us | 481.03 ns | 51.09 us - 51.60 us | -8.40% | | long | 259.61 us | 666.53 ns | 259.23 us - 260.01 us | -5.21% | | tpch | 268.59 us | 776.85 ns | 268.15 us - 269.07 us | -0.03% | | crazy | 1.03 ms | 66.07 us | 992.65 us - 1.07 ms | +6.05% | Licenses MIT sqlglot MIT