Snowflake Supports Trailing Comma for the SELECT Clause

Photo by Christopher Gower on Unsplash

You asked, and we listened. Snowflake now supports a trailing comma at the end of the SELECT clause. We’re committed to providing SQL developers with a better experience in building queries and scripts, and this small enhancement can be a big delighter.

For example, the following query will be allowed:

SELECT department_name, last_name, first_name,
FROM employee_table

Allowing a trailing comma at the end of the SELECT clause is particularly useful when you need to comment out the last line, without having to remove the dangling comma in the previous line. This feature also simplifies the creation of programmatically generated queries, as it eliminates the need for special handling of commas. It, of course, also helps people like me who are not a big fan of the “leading comma” query format.

While this is a convenient feature, it’s primarily a syntactic sugar that makes development a bit easier. For production deployments, where coding standards are higher, we still recommend formatting your queries properly. Avoid cluttering your codebase with an excessive amount of trailing commas.

Happy selecting!

--

--