Snowflake Formatter
Format Snowflake SQL with Snowflake rules for $$ strings, // comments, :: casts and semi-structured paths such as src:customer.name. QUALIFY and MINUS are handled as clauses, SELECT * EXCLUDE, RENAME and REPLACE stay inline and ASOF JOIN starts a new line. Unclosed strings and parentheses are reported with line and column, which helps data engineers review warehouse queries and scripts.
Frequently asked questions
Which Snowflake syntax is understood?
Single-quoted strings with backslash escapes and doubled quotes, $$ dollar-quoted strings, double-quoted identifiers, $1 column references and :: casts are recognized. The // line comments that Snowflake accepts besides -- and /* */ are kept too.
Are semi-structured paths kept intact?
Yes. Paths such as src:customer.name or v:items[0]::string stay joined, so VARIANT access is never split by spaces.
Which Snowflake clauses are supported?
QUALIFY starts its own line and MINUS is handled like the other set operators. ASOF JOIN starts a new line like other joins.
What about SELECT * EXCLUDE?
EXCLUDE, RENAME, REPLACE and ILIKE stay on the same line as the star they modify. SELECT * EXCLUDE (secret) therefore reads as one column expression.
What happens to procedure bodies in $$?
Bodies of JavaScript, Python or Snowflake Scripting procedures written between $$ markers are kept exactly as written. To Snowflake they are strings, so reformatting them could change the code.
Does it support MERGE?
Yes. WHEN MATCHED and WHEN NOT MATCHED branches start new lines.
Does it change keyword case?
No. Keywords and names keep the case you wrote. Quoted identifiers are case sensitive in Snowflake, and they are never touched.
Which errors are detected?
Unclosed strings, $$ strings, quoted identifiers and block comments, and unbalanced parentheses, each with line and column. Nothing is sent to your warehouse.
How large can the input be?
Up to 1 MB per request and 128 KB per statement. Worksheets with many statements are formatted one statement at a time.
Can I choose the indentation, and is my SQL stored?
Use 2 or 4 spaces or tabs. The SQL is formatted in memory only and never saved.