Rust-powered · Free and open source · Apache-2.0
Evidence-backed SQL translation.
Verified results, or a clear no.
Dialects today Snowflake parse · check · translate Databricks translate → DuckDB All dialects →
Translate Snowflake and Databricks SQL into DuckDB SQL. Every rule is proven against real warehouse results. When SQLBabel won't translate, it tells you exactly why.
sqlbabel check orders.sql error[SBL0203]: QUALIFY needs a window function --> orders.sql:5:1 | 5 | QUALIFY revenue > 100 | ^^^^^^^^^^^^^^^^^^^^^ QUALIFY is used without a window | function in the SELECT list or QUALIFY | = help: move the condition to WHERE or HAVING sqlbabel convert revenue.sql SELECT "ORDERS"."CUSTOMER_ID" AS "CUSTOMER_ID", CAST(sum("ORDERS"."TOTAL") AS DECIMAL(24, 2)) AS "REVENUE" FROM "ORDERS" AS "ORDERS" WHERE ("ORDERS"."STATUS" = 'shipped') GROUP BY "ORDERS"."CUSTOMER_ID" sqlbabel convert: done, converted
Where SQL translation goes wrong
The warehouse rejects it at runtime
Invalid SQL only shows up when the query runs on the warehouse, often mid-pipeline.
Tests pass for the wrong engine
On DuckDB, NULLs, decimals and casts behave differently, with no error. Your tests go green locally and the numbers differ in production.
Support depends on the types
A function can convert for one precision and overflow on another. "Supported" means nothing without the types involved.
Best effort means guessing
Most transpilers rewrite what they don't understand and hope. There's no way to tell which parts are guesses.
From warehouse SQL to DuckDB SQL
Snowflake today. Check it, convert it, and know exactly what was refused and why.
Catch what the warehouse would reject
Snowflake today: parses Snowflake SQL and reports the syntax Snowflake would reject. No schema needed. Each error has a code and the exact span; rejections also come with a fix.
sqlbabel check query.sql error[SBL0201]: Snowflake does not support INTERSECT, EXCEPT or MINUS with ALL --> query.sql:1:29 | 1 | SELECT order_id FROM orders INTERSECT ALL SELECT order_id FROM orders | ^^^^^^^^^^^^^ Snowflake does not support INTERSECT with ALL | = help: drop ALL to compare distinct rows; only UNION accepts ALL in Snowflake sqlbabel check: found 1 problem
DuckDB SQL that keeps Snowflake's meaning
Uses your sources' types and only verified rules. NUMBER(12,2) / 3 keeps Snowflake's 8 decimal places.
-- div.sql, with TOTAL as NUMBER(12,2) in sources/orders.yml SELECT order_id, total / 3 AS third FROM orders sqlbabel convert div.sql --no-config SELECT "ORDERS"."ORDER_ID" AS "ORDER_ID", CAST( CAST( ( (CAST(CAST("ORDERS"."TOTAL" AS DECIMAL(38, 2)) * 100000000 AS HUGEINT) * 10) // 3 ) AS DECIMAL(38, 0) ) * 0.000000001 AS DECIMAL(18, 8) ) AS "THIRD" FROM "ORDERS" sqlbabel convert: done, converted
A refusal you can act on
No verified rule, no conversion. The refusal underlines the construct and says what to change.
sqlbabel convert due.sql --no-config error[SBL0008]: HASH gives a different value in DuckDB --> due.sql:2:8 | 2 | HASH(customer_id) AS bucket | ^^^^^^^^^^^^^^^^^ DuckDB computes its own hash, never Snowflake's | = note: Equal inputs still get equal hashes within one run. = note: fine when: Joins, grouping, removing duplicates … = note: wrong when: Storing, comparing or sorting by the hash … = help: allow it with hash = true under [allow] … sqlbabel convert: refused, 1 refusal
Known differences are your call
Some Snowflake behaviour has no exact match in DuckDB, like HASH. Each known difference says when it's fine and when it gives a wrong result. You refuse it, allow it or replace it with your own SQL.
# sqlbabel.toml [allow] hash = true sqlbabel convert due.sql SELECT "ORDERS"."ORDER_ID" AS "ORDER_ID", CAST( … ) AS "BUCKET" FROM "ORDERS" sqlbabel convert: done, converted (1 known difference allowed: hash …)
See what a whole project needs
Point it at a folder of compiled SQL, such as dbt's target/compiled. It shows a diagnostic for each file that doesn't convert, and how many do. It exits 1 when any file is blocked, so CI can track it.
sqlbabel census models --no-config --chain-models error[SBL0002]: SQLBabel can't convert SOUNDEX yet --> models/marts/customer_sounds.sql:3:5 | 3 | SOUNDEX(name) AS name_sound | ^^^^^^^^^^^^^ no rule converts SOUNDEX error[SBL0002]: SQLBabel can't convert WEEKISO yet --> models/staging/stg_orders.sql:1:31 … Converted 1 of 3 files (33%) Blocked: 2 files, 2 causes (SBL0002 SOUNDEX, SBL0002 WEEKISO) sqlbabel census: done, 3 files in … s
The same engine, as a library
The same engine as the CLI, with typed results and diagnostics.
import sqlbabel result = sqlbabel.check(sql="SELECT 1 QUALIFY TRUE") result.diagnostics[0].code # "SBL0203" conversion = sqlbabel.convert( sql="SELECT 1 AS total", options=sqlbabel.ConvertOptions(no_config=True), ) conversion.converted # True
Each panel shows actual sqlbabel output on a small orders example, cut down where marked ….
Measured against the real engine
Every number comes from SQL run on real Snowflake, the first dialect SQLBabel fully supports. How we measure →
95% of Snowflake syntax verified
3,199 of 3,351 documented forms, checked against real Snowflake.
Rules checked against Snowflake
A rule converts only what real Snowflake results back. Anything else gets a clear no.
Start in a minute
Install it with pip, then check a file or convert it with your tables declared in sources/*.yml.
- Snowflake to DuckDB, for running warehouse SQL against small fixtures locally or in CI.
- No account, server or Snowflake connection needed.
- One binary for the command line, and a Python package with the same engine.
- Free and open source, Apache-2.0.
pip install sqlbabel echo "SELECT 1 QUALIFY TRUE" | sqlbabel check error[SBL0203]: QUALIFY needs a window function … echo "SELECT 1 AS total" | sqlbabel convert --no-config SELECT CAST(1 AS DECIMAL(1, 0)) AS "TOTAL" sqlbabel convert: done, converted
Try it on your own SQL
Paste warehouse SQL (Snowflake today) into the playground, or read the docs for the command line, Python and every diagnostic.