CamelCase naming in Snowflake tables?

Viewed 42

This may sound supper petty, buy Snowflake forcing all table names into uppercase has made development rather hard.

tables like

  • stagingUserInfoUK
  • stagingUserDetailUK
  • stagingProduct
  • stagingUser

become

  • STAGINGUSERINFOUK
  • STAGINGUSERDETAILUK
  • STAGINGPRODUCT
  • STAGINGUSER

Which are rather hard to read. I have the same issue with column names:

  • productName
  • productCategoryName
  • productCategoryId

become

  • PRODUCTNAME
  • PRODUCTCATEGORYNAME
  • PRODUCTCATEGORYID

Is there a way to enforce camel-case on table/column names in the snowflake UI?

2 Answers

Identifier Resolution

By default, Snowflake applies the following rules for storing identifiers (at creation/definition time) and resolving them (in queries and other SQL statements):

When an identifier is unquoted, it is stored and resolved in uppercase.

When an identifier is double-quoted, it is stored and resolved exactly as entered, including case.

stagingUserInfoUK - unqouted

"stagingUserInfoUK" - quoted, when used it has to be always accessed using "" around the name

If you quote identifiers Snowflake will respect the case you use.

Try:

CREATE TABLE "CamelCasedTable" ( "CamelColumn" VARCHAR); 

You should find the object is created as desired.

Taken from the linked page below:

By default, Snowflake applies the following rules for storing identifiers (at creation/definition time) and resolving them (in queries and other SQL statements):

  • When an identifier is unquoted, it is stored and resolved in uppercase.
  • When an identifier is double-quoted, it is stored and resolved exactly as entered, including case.

https://docs.snowflake.com/en/sql-reference/identifiers-syntax.html

Related