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
SELECTt.customer_skAS`Customer_IdDWH`, t.customer_idAS`Customer_IdOrig`, t.__identityAS`CustomerCreditLimit_Agg_IdDWH`, t.kreditlimit_intern/* not existing, proposal: credit_limit_intern (92%) */AS`KreditlimitIntern`, t.kreditlimit_versichert/* not existing */AS`KreditlimitVersichert`, t.valid_from/* not existing */AS`ValidFrom`, t.valid_to/* not existing */AS`ValidTo`FROM`gold`.`dim_customer_credit_limit_agg`AS t
sqlfmt produces this:
select/* not existing */t.customer_skas`Customer_IdDWH`,
t.customer_idas`Customer_IdOrig`,
t.__identityas`CustomerCreditLimit_Agg_IdDWH`,
t.kreditlimit_internas`KreditlimitIntern`,
t.kreditlimit_versichertas`KreditlimitVersichert`,
t.valid_fromas`ValidFrom`,
t.valid_toas`ValidTo`from`gold`.`dim_customer_credit_limit_agg`as t /* not existing */
Some comments are removed entirely, others are just at the wrong place
Expected behavior
The comments should stick where they are. Interestingly, if I first format the SQL above with the VS Code SQLTools and start with this:
SELECTt.customer_skAS`Customer_IdDWH`,
t.customer_idAS`Customer_IdOrig`,
t.__identityAS`CustomerCreditLimit_Agg_IdDWH`,
t.kreditlimit_intern/* not existing, proposal: credit_limit_intern (92%) */AS`KreditlimitIntern`,
t.kreditlimit_versichert/* not existing */AS`KreditlimitVersichert`,
t.valid_from/* not existing */AS`ValidFrom`,
t.valid_to/* not existing */AS`ValidTo`FROM`gold`.`dim_customer_credit_limit_agg`AS t
then it works. Don't know if that helps
Additional context
What is the output of sqlfmt --version? sqlfmt, version 0.18.0
The text was updated successfully, but these errors were encountered:
Wow, I'm shocked, but can repro. I'm sure it's because there are multiple comments on one line -- I don't think we have a test case for that, and that's impossible with the typical -- comments. Thanks for the report!
tconbeer
changed the title
sqlfmt removes Comments
sqlfmt removes Comments when there are multiple C-style comments on one line
May 10, 2023
Describe the bug
I have the following sql:
sqlfmt produces this:
Some comments are removed entirely, others are just at the wrong place
Expected behavior
The comments should stick where they are. Interestingly, if I first format the SQL above with the VS Code SQLTools and start with this:
then it works. Don't know if that helps
Additional context
What is the output of
sqlfmt --version
?sqlfmt, version 0.18.0
The text was updated successfully, but these errors were encountered: