Skip to content

Reference

Diagnostic reference

Every SQLBabel diagnostic code, what it means and how to fix it.

Every diagnostic SQLBabel prints has one of these codes. A code is never reused or renumbered. See Reading diagnostics for the output format.

Code Name Meaning
SBL0001 parse_fidelity the SQL does not parse
SBL0002 missing_rule SQLBabel can’t convert this yet
SBL0003 type_condition SQLBabel can’t convert this for these types
SBL0004 unresolved_name SQLBabel doesn’t know this name
SBL0005 not_expressible DuckDB can’t do what Snowflake does here
SBL0006 conversion_budget Converting this took too long or produced too much SQL
SBL0007 session_parameters SQLBabel can’t convert for these session settings
SBL0008 divergence_refused This needs a known difference that isn’t allowed
SBL0009 unaliased_output_name This column needs an alias, because SQLBabel can’t be sure of the name Snowflake gives it
SBL0101 input_too_large the input is larger than the parser accepts
SBL0102 token_budget_exceeded the input has more tokens than the parser accepts
SBL0103 nesting_depth_exceeded brackets nest deeper than the parser accepts
SBL0104 parser_depth_exceeded the statement nests deeper than the parser accepts
SBL0105 ast_depth_exceeded the parsed statement nests deeper than SQLBabel accepts
SBL0106 ast_budget_exceeded the parsed statement is larger than SQLBabel accepts
SBL0107 function_nesting_depth_exceeded function calls nest deeper than SQLBabel accepts
SBL0201 set_operation_all Snowflake does not support INTERSECT, EXCEPT or MINUS with ALL
SBL0202 lock_wait Snowflake does not support WAIT in FOR UPDATE
SBL0203 qualify_without_window QUALIFY needs a window function
SBL0204 star_filter_drops_named_column REPLACE or RENAME names a column the star’s ILIKE pattern removed
SBL0205 window_without_over A window function needs an OVER clause
SBL0206 double_equals Unknown function ==
SBL0211 unsupported_type_literal Snowflake has no literal of this date-time type

Why a statement was not converted.

the SQL does not parse (parse_fidelity)

SQLBabel’s Snowflake parser could not read the SQL, so nothing in it was converted. The span points where the parser stopped and the label carries the parser’s message. Check the SQL at that point against Snowflake’s grammar; if Snowflake accepts the statement, SQLBabel’s parser is missing the syntax and the statement should be reported with the label. Where the line holds dbt Jinja, the help says to compile the model with dbt first, since Snowflake does not parse Jinja either.

Example:

echo "SELECT a, FROM orders WHERE (b = 1" | sqlbabel check

SQLBabel can’t convert this yet (missing_rule)

SQLBabel converts only what it has checked against results recorded in Snowflake. Nothing checked converts the construct at the span yet, so the statement is refused rather than turned into SQL that might mean something else in DuckDB. Rewrite the statement without it; sqlbabel census shows which constructs a body of SQL needs.

Example:

echo "SELECT WEEKISO(CURRENT_DATE()) AS w" | sqlbabel convert --no-config

SQLBabel can’t convert this for these types (type_condition)

SQLBabel converts the construct at the span only for the types checked against Snowflake, and the values here have other types, or types SQLBabel could not work out. Declaring the relation’s columns and types in the project’s sources often settles the types; an explicit cast to a supported type also works when it keeps the statement’s meaning.

Help: declare the columns’ Snowflake types in the project’s sources, or cast the values to a type it supports; for a function, cast them to a type the label names

Example:

echo "SELECT FLOOR('abc') AS f" | sqlbabel convert --no-config

SQLBabel doesn’t know this name (unresolved_name)

Converting a statement needs to know what each relation and column name refers to and what type it has. The name at the span is unknown, or matches more than one column. Add the relation and its columns to a source file in the project’s sources/ folder, or qualify an ambiguous column with its relation.

Help: declare the relation and its columns in a source file of the project (sources/*.yml)

Example:

echo "SELECT a FROM orders" | sqlbabel convert --no-config

DuckDB can’t do what Snowflake does here (not_expressible)

The construct at the span does something in Snowflake that DuckDB has no way to reproduce, for the reason in the label, so no later version will convert it as written. Rewrite the statement so it does not depend on that behaviour.

Example: no construct is declared inexpressible yet; one would be refused with the reason as its label

Converting this took too long or produced too much SQL (conversion_budget)

Converting the statement took longer, or produced more DuckDB SQL, than SQLBabel allows for one statement, which keeps one unusual input from stalling a run. Splitting the statement, for example into common table expressions or separate statements, usually brings it under the limit.

Help: split the statement into smaller statements

Example: a statement whose conversion runs past the time budget or emits more DuckDB SQL than it allows

SQLBabel can’t convert for these session settings (session_parameters)

Converted SQL is checked against Snowflake under particular session settings. The settings given differ from every checked set, so nothing is known to convert correctly for that session. The label names the settings; settings left unset take Snowflake’s documented defaults.

Help: run the SQL in a session whose settings SQLBabel has checked

Example:

echo "SELECT 1 AS one" | sqlbabel convert --no-config --session WEEK_START=1

This needs a known difference that isn’t allowed (divergence_refused)

The construct at the span converts only with a known difference between Snowflake and DuckDB, where DuckDB may raise an error or give a different value. The message names it, the label says what differs, and the note says when that is fine and when it is wrong. sqlbabel.toml, or the defaults without one, does not allow it here, so the statement is refused. Allow it if your use is one where it is fine, or rewrite the statement without the construct; sqlbabel explain --differences lists every known difference and whether it is allowed.

Help: the help gives the one fix that works here, such as allowing the known difference in sqlbabel.toml; sqlbabel explain <name> describes it

Example:

echo "SELECT HASH(1) AS h" | sqlbabel convert --no-config

This column needs an alias, because SQLBabel can’t be sure of the name Snowflake gives it (unaliased_output_name)

Snowflake names an unaliased select item after its written text, upper-cased in full with spacing, comments and quotes kept and cut at 255 characters, and a converted query must return the same column names. SQLBabel writes that name as an alias for the shapes checked against Snowflake: literals in any spelling, columns, arithmetic, ||, comparisons, AND, OR, NOT, IS NULL, parentheses, casts, CASE, IFF, the clock functions and a list of functions and aggregates, nested freely. Other items, such as paths, window functions, non-ASCII text, line comments or unlisted functions, are refused rather than converted under a name that might differ. The help suggests the exact alias; an alias fixes the name in both engines.

Help: add an alias, such as AS total, which names the column in both engines

Example:

echo "SELECT 'café' || 'b'" | sqlbabel convert --no-config

Limits that keep parsing and conversion bounded.

the input is larger than the parser accepts (input_too_large)

The parser refuses inputs beyond a fixed size so that one input cannot exhaust memory. Split the SQL into several inputs and convert each.

Help: split the input into smaller files

Example:

python3 -c "print('SELECT 1;' * 2000000)" | sqlbabel check

Also reported by its guard name, E_GUARD_INPUT_TOO_LARGE.

the input has more tokens than the parser accepts (token_budget_exceeded)

The parser refuses inputs with more tokens than its budget so that parsing time stays bounded. Split the SQL into several statements or inputs.

Help: split the input into smaller statements or files

Example:

python3 -c "print('SELECT 1;' * 400000)" | sqlbabel check

Also reported by its guard name, E_GUARD_TOKEN_BUDGET_EXCEEDED.

brackets nest deeper than the parser accepts (nesting_depth_exceeded)

Parentheses, brackets and braces nest deeper at the span than the parser’s limit of 512. The limit keeps parsing from exhausting the stack, and no setting raises it. Redundant parentheses can be removed; deeply nested subqueries can usually become common table expressions.

Help: remove redundant parentheses, or move nested parts into common table expressions; the limit of 512 is fixed, and –max-call-depth can’t raise it

Example:

python3 -c "print('SELECT ' + '(' * 600 + '1' + ')' * 600)" | sqlbabel check

Also reported by its guard name, E_GUARD_NESTING_DEPTH_EXCEEDED.

the statement nests deeper than the parser accepts (parser_depth_exceeded)

The parser’s recursion reached its depth limit at the span. The limit keeps parsing from exhausting the stack. Restructure the deepest part of the statement, for example with common table expressions.

Help: move nested parts into common table expressions

Example:

python3 -c "print('SELECT ' + 'NOT ' * 2000 + 'TRUE')" | sqlbabel check

Also reported by its guard name, E_GUARD_PARSER_DEPTH_EXCEEDED.

the parsed statement nests deeper than SQLBabel accepts (ast_depth_exceeded)

The statement parsed, but its tree nests deeper than the limit of 512 SQLBabel places on later analysis, which keeps conversion from exhausting the stack. No setting raises it. Restructure the deepest part of the statement.

Help: move nested parts into common table expressions; the limit of 512 is fixed, and –max-call-depth can’t raise it

Example:

python3 -c "print('SELECT ' + 'CASE WHEN TRUE THEN ' * 600 + '1' + ' END' * 600)" | sqlbabel check

Also reported by its guard name, E_GUARD_AST_DEPTH_EXCEEDED.

the parsed statement is larger than SQLBabel accepts (ast_budget_exceeded)

The statement parsed into more tree nodes than SQLBabel’s budget, which keeps conversion time and memory bounded. Split it into smaller statements.

Help: split the statement into smaller statements

Example: a statement that parses into more than a million tree nodes

Also reported by its guard name, E_GUARD_AST_BUDGET_EXCEEDED.

function calls nest deeper than SQLBabel accepts (function_nesting_depth_exceeded)

Function calls nest inside each other deeper than SQLBabel’s limit at the span, 256 by default. Compute the innermost calls in a common table expression or a subquery and refer to their results, or raise the limit with --max-call-depth on the command line or max_call_depth= in Python. The limit goes up to 512, the parser’s fixed nesting limit.

Help: compute inner calls in a common table expression first, or raise the limit, up to 512, with –max-call-depth (command line) or max_call_depth= (Python)

Example:

python3 -c "print('SELECT ' + 'ABS(' * 300 + '1' + ')' * 300)" | sqlbabel check

Also reported by its guard name, E_GUARD_FUNCTION_NESTING_DEPTH_EXCEEDED.

SQL that parses but that Snowflake rejects when it runs.

Snowflake does not support INTERSECT, EXCEPT or MINUS with ALL (set_operation_all)

Snowflake accepts ALL only after UNION. INTERSECT ALL, EXCEPT ALL and MINUS ALL parse, but Snowflake rejects them as an unsupported feature, so there is no Snowflake meaning to convert. Without ALL the operators compare distinct rows; keeping duplicates needs a rewrite, for example numbering each row with ROW_NUMBER() over all columns and comparing those pairs.

Help: drop ALL to compare distinct rows; only UNION accepts ALL in Snowflake

Example:

echo "SELECT id FROM orders INTERSECT ALL SELECT id FROM returns" | sqlbabel check

Snowflake does not support WAIT in FOR UPDATE (lock_wait)

FOR UPDATE WAIT n parses, but Snowflake rejects it as an unsupported feature, so the statement never runs there. Remove the WAIT clause; Snowflake’s lock timeout comes from the LOCK_TIMEOUT session parameter instead.

Help: remove the WAIT clause

Example:

echo "SELECT order_id FROM orders FOR UPDATE WAIT 7" | sqlbabel check

QUALIFY needs a window function (qualify_without_window)

Snowflake evaluates QUALIFY after window functions, and rejects a QUALIFY clause when neither the SELECT list nor QUALIFY itself calls a window function (Snowflake error 992). A window function the QUALIFY condition reaches through a SELECT-list alias counts. A condition on plain columns belongs in WHERE, and one on aggregates in HAVING.

Help: move the condition to WHERE or HAVING, or filter on a window function’s result

Example:

echo "SELECT 1 QUALIFY TRUE" | sqlbabel check

REPLACE or RENAME names a column the star’s ILIKE pattern removed (star_filter_drops_named_column)

In * ILIKE 'pattern' REPLACE (...) or RENAME (...), Snowflake applies the pattern first, ignoring case, and rejects a REPLACE or RENAME of a column the pattern did not keep (Snowflake error 1431). A name that fails the pattern ignoring case fails it whatever the table holds, so no schema is needed to see it.

Help: name a column the ILIKE pattern keeps, or widen the pattern

Example:

echo "SELECT * ILIKE '%_id' REPLACE (price * 2 AS price) FROM orders" | sqlbabel check

A window function needs an OVER clause (window_without_over)

CUME_DIST, PERCENT_RANK and NTH_VALUE are window functions only: Snowflake rejects a call to one without an OVER clause when compiling the query (Snowflake error 2064, missing window specification), so the statement never runs there. Add the OVER clause that says which rows the function ranks or reads.

Help: add an OVER clause, such as OVER (ORDER BY ...)

Example:

echo "SELECT CUME_DIST() AS d FROM orders" | sqlbabel check

Unknown function == (double_equals)

Snowflake has no == operator. The statement parses, but Snowflake reads == as a call to a function of that name and rejects the query when compiling it (Snowflake error 2139, unknown function), so the statement never runs there. Other dialects read == as =; SQLBabel does not, because that would convert SQL Snowflake rejects. Write = instead.

Help: compare with =

Example:

echo "SELECT order_id FROM orders WHERE status == 'shipped'" | sqlbabel check

Snowflake has no literal of this date-time type (unsupported_type_literal)

Only DATE, TIME and TIMESTAMP take a string as a typed literal in Snowflake, and only without a precision. A date-time type with a precision before a string, such as TIMESTAMP_NTZ(3), DATETIME(3), TIMESTAMP(3) or TIME(3), parses, but Snowflake rejects it as an unsupported data type literal (Snowflake error 2121). Without a precision, TIMESTAMP_NTZ, TIMESTAMP_LTZ, TIMESTAMP_TZ or DATETIME before a string is a syntax error. Cast the string with :: or CAST, or call TO_TIMESTAMP_NTZ, TO_TIMESTAMP_LTZ, TO_TIMESTAMP_TZ, TO_TIMESTAMP or TO_TIME.

Help: cast the string instead, e.g. '2026-01-02'::TIMESTAMP_NTZ(3)

Example:

echo "SELECT TIMESTAMP_NTZ(3) '2026-01-02 03:04:05' AS v" | sqlbabel check