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

Trailing Comma - Snowflake #244

Open
ryaminal opened this issue Mar 19, 2024 · 4 comments
Open

Trailing Comma - Snowflake #244

ryaminal opened this issue Mar 19, 2024 · 4 comments

Comments

@ryaminal
Copy link

ryaminal commented Mar 19, 2024

Curious what the thoughts are on supporting a trailing comma in SQL? Snowflake just announced support for this in their dialect.
Example:

SELECT emp_id,
       name,
       dept,
FROM employees;

This doesn't appear to be handled by tree-sitter-sql yet(as it was just announced) but curious if this is something tree-sitter-sql wants to support? Or would it be better to make a dialect-specific repo?

@DerekStride
Copy link
Owner

I'm up for adding it! You interested in writing the PR?

@ryaminal
Copy link
Author

yeah, i'll give it a go. do you want it behind a flag or anything?

@DerekStride
Copy link
Owner

Adding it to the existing behaviour is good

@matthias-Q
Copy link
Collaborator

Not sure if I am a fan of adding the trailing comma. This is a convenience addition by snowflake and - as of now - is only supported by snowflake. It saved me more than once to see an error in the highlighting, when having a trailing comma that my query engines (postgres/impala/athena) do not accept. Since this parser does not distinguish between dialects it would not through an error.

In this particular case it would not be wise to be permissive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants