SQL Transpiler https://github.com/jesusdf/unique
8.9K
ℹ️ Note from the developer / analyst
This project is just too big for one lifetime, so I'm backing it with AI. The goal is to provide a working tool; how we get there is not that important.
Unique translates SQL scripts between SQL Server (T-SQL), Oracle, PostgreSQL, and MySQL — including stored procedures, functions, and triggers, not just standalone queries. SQLite is an import-only source (it has no procedural language, so it can never be a target).
sqlglot (a load-bearing, exact-pinned dependency — see docs/sqlglot-dependency.md) translates individual statements. Unique adds the stored-routine shell that is outside sqlglot's statement model:
CREATE PROCEDURE/FUNCTION/TRIGGER bodies: parameter directions, DECLARE,
IF/WHILE/LOOP/FOR, cursors, RETURN, RAISE/THROW, TRY/CATCH,
transactions — with the embedded DML routed through sqlglot.TRY/CATCH → MySQL
DECLARE ... HANDLER; table variables → temporary tables;
SELECT @v = expr → SELECT ... INTO; STRING_SPLIT → MySQL
JSON_TABLE; PostgreSQL triggers split into trigger function +
CREATE TRIGGER./* UNIQUE: <original> */ comment and a warning,
so a round-trip can restore the original. Source comments are preserved.GO splitting, source-dialect
auto-detection, source-syntax validation (errors located by line before
transpiling), and a structural fingerprint compared before/after to catch
silent semantic drift. Output is validated against the real target engines
in CI.pip install -e ".[dev]"
# CLI
unique transpile input.sql --from tsql --to postgresql -o output.sql
# Structural-similarity of two scripts (migration audit; dialects auto-detect)
unique compare original.sql migrated.sql --dialect-a tsql --dialect-b oracle
from unique.core import transpile
print(transpile("SELECT TOP 10 * FROM users", source="tsql", target="postgresql").sql)
# SELECT * FROM users LIMIT 10
Or run the REST API + web UI with Docker (image published on release tags):
docker run --rm -p 8000:8000 jesusdf/unique:latest # open http://localhost:8000/
Full CLI, Python, REST, web UI, and Docker details: Installation & Deployment and Interfaces.
English-only by design — code, comments, docs, and all program output. Transpiler diagnostics quote or mirror the engines' own error text, which is English, so every message stays searchable verbatim.
MIT (see LICENSE).
Content type
Image
Digest
sha256:30c4c3154…
Size
53.7 MB
Last updated
about 2 months ago
docker pull jesusdf/unique