Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snowflake's forward-slash comments are broken #468

Closed
nilsonavp opened this issue Aug 18, 2023 · 2 comments · Fixed by #487
Closed

Snowflake's forward-slash comments are broken #468

nilsonavp opened this issue Aug 18, 2023 · 2 comments · Fixed by #487
Labels
bug Something isn't working
Milestone

Comments

@nilsonavp
Copy link

Describe the bug
Snowflake supports two other types of comments, // for single line comments and /* */ for multi-line comments.
https://community.snowflake.com/s/article/how-to-comment-or-uncomment-multiple-lines-in-the-sql-worksheet
Currently, /* */ is working correctly but, // is not being interpreted correctly.

To Reproduce
Add any line with // as a comment. E.g.:

select * from  {{ ref("events") }} e
// join from events table
left join {{ ref("users") }} u
on u.id = e.user_id

Expected behavior
Comment should be kept as is and other lines formatted. E.g.:

select *
from {{ ref("events") }} e
// join from events table
left join {{ ref("users") }} u on u.id = e.user_id

Actual behavior
Files gets jumbled, breaking logic. E.g.:

select *
from {{ ref("events") }} e / /
join
from events table
left join {{ ref("users") }} u on u.id = e.user_id

Additional context
sqlfmt, version 0.19.2

@tconbeer
Copy link
Owner

What the hell -- why do we need like 10 ways to comment things in SQL.

Why would Snowflake bind ctrl+/ to //, which is only a comment in snowflake sql, instead of --? Ugh.

@tconbeer tconbeer added the bug Something isn't working label Aug 18, 2023
@nilsonavp
Copy link
Author

What the hell -- why do we need like 10 ways to comment things in SQL.

Why would Snowflake bind ctrl+/ to //, which is only a comment in snowflake sql, instead of --? Ugh.

Yeah, I'm with you on that one.
It just makes things look awful, and serves no purpose other than to make things more complicated to parse 😓

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants