{"id":45546044,"url":"https://github.com/tobilg/polyglot","last_synced_at":"2026-02-23T04:48:14.746Z","repository":{"id":338646779,"uuid":"1135074421","full_name":"tobilg/polyglot","owner":"tobilg","description":"Rust/Wasm-powered SQL transpiler","archived":false,"fork":false,"pushed_at":"2026-02-15T17:35:25.000Z","size":3032,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-15T23:29:42.627Z","etag":null,"topics":["rust","sql","sqlglot","transpiler","wasm"],"latest_commit_sha":null,"homepage":"https://polyglot.gh.tobilg.com","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tobilg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-15T15:50:37.000Z","updated_at":"2026-02-15T17:35:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tobilg/polyglot","commit_stats":null,"previous_names":["tobilg/polyglot"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/tobilg/polyglot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobilg%2Fpolyglot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobilg%2Fpolyglot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobilg%2Fpolyglot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobilg%2Fpolyglot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tobilg","download_url":"https://codeload.github.com/tobilg/polyglot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobilg%2Fpolyglot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29738081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T04:36:46.119Z","status":"ssl_error","status_checked_at":"2026-02-23T04:36:25.794Z","response_time":90,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust","sql","sqlglot","transpiler","wasm"],"created_at":"2026-02-23T04:48:14.094Z","updated_at":"2026-02-23T04:48:14.736Z","avatar_url":"https://github.com/tobilg.png","language":"Rust","readme":"# Polyglot\n\nRust/Wasm-powered SQL transpiler for 32 dialects, inspired by [sqlglot](https://github.com/tobymao/sqlglot).\n\nPolyglot parses, generates, transpiles, and formats SQL across 32 database dialects. It ships as a Rust crate ([`polyglot-sql`](https://crates.io/crates/polyglot-sql/)) and a TypeScript/WASM SDK ([`@polyglot-sql/sdk`](https://www.npmjs.com/package/@polyglot-sql/sdk) on npm).\n\nThere's also a [playground](https://polyglot-playground.gh.tobilg.com/) where you can try it out in the browser, as well as the [Rust API Docs](https://docs.rs/polyglot-sql/latest/polyglot_sql/) and [TypeScript API Docs](https://polyglot.gh.tobilg.com/).\n\n## Features\n\n- **Transpile** SQL between any pair of 32 dialects\n- **Parse** SQL into a fully-typed AST\n- **Generate** SQL back from AST nodes\n- **Format** / pretty-print SQL\n- **Fluent builder API** for constructing queries programmatically\n- **Validation** with syntax, semantic, and schema-aware checks\n- **AST visitor** utilities for walking, transforming, and analyzing queries\n\n## Supported Dialects (32)\n\n| | | | | |\n|---|---|---|---|---|\n| Athena | BigQuery | ClickHouse | CockroachDB | Databricks |\n| Doris | Dremio | Drill | Druid | DuckDB |\n| Dune | Exasol | Fabric | Hive | Materialize |\n| MySQL | Oracle | PostgreSQL | Presto | Redshift |\n| RisingWave | SingleStore | Snowflake | Solr | Spark |\n| SQLite | StarRocks | Tableau | Teradata | TiDB |\n| Trino | TSQL | | | |\n\n## Quick Start\n\n### Rust\n\n```rust\nuse polyglot_sql::{transpile, DialectType};\n\n// Transpile MySQL to PostgreSQL\nlet result = transpile(\n    \"SELECT IFNULL(a, b) FROM t\",\n    DialectType::MySQL,\n    DialectType::Postgres,\n).unwrap();\nassert_eq!(result[0], \"SELECT COALESCE(a, b) FROM t\");\n```\n\n```rust\nuse polyglot_sql::builder::*;\n\n// Fluent query builder\nlet query = select([\"id\", \"name\"])\n    .from(\"users\")\n    .where_(col(\"age\").gt(lit(18)))\n    .order_by([\"name\"])\n    .limit(10)\n    .build();\n```\n\nSee the full [Rust crate README](crates/polyglot-sql/README.md) for more examples.\n\n### TypeScript\n\n```bash\nnpm install @polyglot-sql/sdk\n```\n\n```typescript\nimport { transpile, Dialect } from '@polyglot-sql/sdk';\n\n// Transpile MySQL to PostgreSQL\nconst result = transpile(\n  'SELECT IFNULL(a, b) FROM t',\n  Dialect.MySQL,\n  Dialect.PostgreSQL,\n);\nconsole.log(result.sql[0]); // SELECT COALESCE(a, b) FROM t\n```\n\n```typescript\nimport { select, col, lit } from '@polyglot-sql/sdk';\n\n// Fluent query builder\nconst sql = select('id', 'name')\n  .from('users')\n  .where(col('age').gt(lit(18)))\n  .orderBy(col('name').asc())\n  .limit(10)\n  .toSql('postgresql');\n```\n\nSee the full [TypeScript SDK README](packages/sdk/README.md) for more examples.\n\n## Project Structure\n\n```\npolyglot/\n├── crates/\n│   ├── polyglot-sql/           # Core Rust library (parser, generator, builder)\n│   └── polyglot-sql-wasm/      # WASM bindings\n├── packages/\n│   ├── sdk/                    # TypeScript SDK (@polyglot-sql/sdk on npm)\n│   └── playgroud/              # Playground for testing the SDK (React 19, Tailwind v4, Vite)\n└── tools/\n    ├── sqlglot-compare/        # Test extraction \u0026 comparison tool\n    └── bench-compare/          # Performance benchmarks\n```\n\n## Examples\n\nStandalone example projects are available in the [`examples/`](examples/) directory. Each one pulls the latest published package and can be run independently.\n\n### Rust\n\n```bash\ncargo run --manifest-path examples/rust/Cargo.toml\n```\n\n### TypeScript\n\n```bash\ncd examples/typescript\npnpm install --ignore-workspace \u0026\u0026 pnpm start\n```\n\n## Building from Source\n\n```bash\n# Build Rust core\ncargo build -p polyglot-sql\n\n# Build WASM + TypeScript SDK\nmake build-all\n\n# Or step by step:\ncd crates/polyglot-sql-wasm \u0026\u0026 wasm-pack build --target bundler --release\ncd packages/sdk \u0026\u0026 npm run build\n```\n\n## Testing\n\nPolyglot 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.\n\n| Category | Count | Pass Rate |\n|----------|------:|:---------:|\n| SQLGlot generic identity | 956 | 100% |\n| SQLGlot dialect identity | 3,554 | 100% |\n| SQLGlot transpilation | 5,513 | 100% |\n| SQLGlot transpile (generic) | 145 | 100% |\n| SQLGlot parser | 29 | 100% |\n| SQLGlot pretty-print | 23 | 100% |\n| Lib unit tests | 739 | 100% |\n| Custom dialect identity | 276 | 100% |\n| Custom dialect transpilation | 347 | 100% |\n| ClickHouse parser corpus (non-skipped) | 7,047 | 100% |\n| **Total (strict pass/fail case count)** | **18,629** | **100%** |\n\n```bash\n# Setup fixtures (required once)\nmake setup-fixtures\n\n# Run all tests\nmake test-rust-all          # All SQLGlot fixture suites\nmake test-rust-lib          # Lib unit tests\nmake test-rust-verify       # Full strict verification suite\n\n# Individual test suites\nmake test-rust-identity     # 956 generic identity cases\nmake test-rust-dialect      # 3,554 dialect identity cases\nmake test-rust-transpile    # 5,513 transpilation cases\nmake test-rust-pretty       # 23 pretty-print cases\n\n# Additional tests\nmake test-rust-roundtrip    # Organized roundtrip unit tests\nmake test-rust-matrix       # Dialect matrix transpilation tests\nmake test-rust-compat       # SQLGlot compatibility tests\nmake test-rust-errors       # Error handling tests\nmake test-rust-functions    # Function normalization tests\n\n# TypeScript SDK tests\ncd packages/sdk \u0026\u0026 npm test\n\n# Full comparison against Python SQLGlot\nmake test-compare\n```\n\n### Benchmarks\n\n```bash\nmake bench-compare          # Compare polyglot-sql vs sqlglot performance\nmake bench-rust             # Rust benchmarks (JSON output)\nmake bench-python           # Python sqlglot benchmarks (JSON output)\ncargo bench -p polyglot-sql  # Criterion benchmarks\n```\n\n### Fuzzing\n\n```bash\ncargo +nightly fuzz run fuzz_parser\ncargo +nightly fuzz run fuzz_roundtrip\ncargo +nightly fuzz run fuzz_transpile\n```\n\n## Makefile Targets\n\n| Target | Description |\n|--------|-------------|\n| `make help` | Show all available commands |\n| `make build-all` | Build WASM + Rust (release) |\n| `make build-wasm` | Build WASM package + TypeScript SDK |\n| `make test-rust` | Run all sqlglot compatibility tests |\n| `make test-rust-all` | Run all 10,220 SQLGlot fixture cases |\n| `make test-rust-lib` | Run 739 lib unit tests |\n| `make test-rust-verify` | Full verification suite |\n| `make test-compare` | Compare against Python sqlglot |\n| `make bench-compare` | Performance comparison |\n| `make extract-fixtures` | Regenerate JSON fixtures from Python |\n| `make setup-fixtures` | Create fixture symlink for Rust tests |\n| `make generate-bindings` | Generate TypeScript type bindings |\n| `make clean` | Remove all build artifacts |\n\n## Licenses\n\n[MIT](LICENSE)\n[sqlglot MIT](licenses/SQLGLOT_LICENSE.md)\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobilg%2Fpolyglot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobilg%2Fpolyglot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobilg%2Fpolyglot/lists"}