You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By passing a language value corresponding to the warehouse setting in Dataform to the formatter, we can expect more appropriate formatting.
But if we use the neutral default sql that means StandardSQL, formatting for UNNEST and QUALIFY will not work well, and I think it need to refer to the warehouse value in dataform.json.
I have also confirmed that the formatting result changes in some cases. The files under examples/formatter/ seems to assume BigQuery, so if we format as BigQuery,
The space after IF, IFNULL disappears
A space is added after UNNEST
A line break is added after ALTER TABLE {name}
While sql-formatter updating brings differences in the formatting results, QUALIFY is a frequently used clause, and named arguments are broken by current formatter. The update makes the format command practical.
Could you take a look at the pull request I'm going to send here? You may use only some of the commits.
The text was updated successfully, but these errors were encountered:
Would you like to update sql-formatter?
Currently, dataform CLI depends on version
^2.3.3
, which is about 4 years old.The latest version is
12.2.1
.By updating, we can resolve the following issues related to formatting:
dataform format
breaks triple-quoted strings in BigQuery #1444Handling dialects in sql-formatter
The current version of sql-formatter have a feature for "dialects" specific to different database products.
Now sql-formatter covers all SQL dialects supported warehouse by Dataform.
https://github.com/sql-formatter-org/sql-formatter/blob/master/docs/language.md
By passing a language value corresponding to the warehouse setting in Dataform to the formatter, we can expect more appropriate formatting.
But if we use the neutral default
sql
that means StandardSQL, formatting for UNNEST and QUALIFY will not work well, and I think it need to refer to the warehouse value indataform.json
.I have also confirmed that the formatting result changes in some cases. The files under
examples/formatter/
seems to assume BigQuery, so if we format as BigQuery,IF
,IFNULL
disappearsUNNEST
ALTER TABLE {name}
While sql-formatter updating brings differences in the formatting results, QUALIFY is a frequently used clause, and named arguments are broken by current formatter. The update makes the format command practical.
Could you take a look at the pull request I'm going to send here? You may use only some of the commits.
The text was updated successfully, but these errors were encountered: