tree-sitter-sql
tree-sitter-sql copied to clipboard
Trailing Comma - Snowflake
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?
I'm up for adding it! You interested in writing the PR?
yeah, i'll give it a go. do you want it behind a flag or anything?
Adding it to the existing behaviour is good
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.