Snowflake-Labs / terraform-provider-snowflake

Terraform provider for managing Snowflake accounts
https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest
MIT License
548 stars 419 forks source link

Table columns created with double quotes #1387

Open rombat opened 1 year ago

rombat commented 1 year ago

Provider Version

0.52.0

Terraform Version 1.3.3

Describe the bug

Whenever I create a table as described by your documentation, I have to set the columns names with double quotes. The thing is, the columns name are created with double quotes as their names. For instance:

  column {
    name = "project_id"
    type = "VARCHAR"
  }

=> the column name will be "projectId". It's really annoying, because for every query using this column, I'd have to add the double quotes. image

Expected behavior

create columns without double quotes

rombat commented 1 year ago

Hi there, Any news about this issue ? It's kind of problematic for us since we'd like to deploy our production environment, but without this issue. Thanks in advance and have a nice day

bennylu2 commented 1 year ago

iirc the provider puts double-quotes on object names in order to handle the case where you want to specify quoted identifiers https://docs.snowflake.com/en/sql-reference/identifiers-syntax.html

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.

I think you want to specify the column names in terraform in UPPERCASE if you would like to reference them without quotes in Snowflake