CLI commands
sqlbabel check
Check that Snowflake SQL parses and holds nothing Snowflake rejects, without converting it.
sqlbabel check parses Snowflake SQL and reports what Snowflake would reject. It needs no schema
and no policy, and it converts nothing.
sqlbabel check [OPTIONS] [PATH]sqlbabel check query.sqlecho "SELECT 1 QUALIFY TRUE" | sqlbabel check --jsonPATH is a SQL file. Without one, or with -, check reads standard input.
$ sqlbabel check query.sqlerror[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 Snowflakesqlbabel check: found 1 problemWhat it reports
Section titled “What it reports”- SQL that does not parse:
SBL0001, with the span where the parser stopped. - Input beyond the parser’s limits: the
SBL01xxcodes. - SQL that parses but that Snowflake rejects, such as
INTERSECT ALL,FOR UPDATE WAIT,QUALIFYwithout a window function, or a* ILIKEREPLACEorRENAMEof a column the pattern removes: theSBL02xxcodes.
Options
Section titled “Options”| Option | Meaning |
|---|---|
--format text|json |
Print the report as text for people or JSON for programs. Default text. |
--json |
The same as --format json. |
--color auto|always|never |
Colour diagnostics. Default auto: only on a terminal, honouring NO_COLOR and CLICOLOR_FORCE. |
--max-call-depth <n> |
Refuse function calls nested more than n deep with SBL0107. Default 256, at most 512, the parser’s fixed nesting limit. |
With --json, check prints {"ok": …, "diagnostics": [...]}. See
JSON output.
Exit status
Section titled “Exit status”| Code | Meaning |
|---|---|
0 |
No problem found. |
1 |
At least one problem found. |
2 |
The input holds no SQL, can’t be read, or an option is invalid, such as --max-call-depth above 512. |