Avoid table replacement with the changing of schema name #1146
Labels
category:resource
feature-request
Used to mark issues with provider's missing functionalities
resource:table
Issue connected to the snowflake_table resource
Minimal Example Code:
Corresponding resources:
Changing the
snowflake_schema.my_schema
name fromFOO
to something else (e.g.BAR
) will destroy the current table and create a new one (a forced replacement).And the table will lose all data:
This is obviously not ideal, especially because Snowflake allows you to change a Schema name without losing the table data. In other words, if I wasn't tracking the
PEOPLE
table with terraform, I wouldn't lose any data and the table would gracefully live in theBAR
schema as desired.Note that you can actually bypass this issue with the following steps (that is what I did when faced with such scenario):
terraform state rm snowflake_table.my_table
to remove the trackedmy_table
my_schema
name to what you desire (e.g. fromFOO
toBAR
)terraform import snowflake_table.my_table MY_DB|BAR|PEOPLE
to import the table with all of our data in the new schema.Obviously the steps above are not ideal (since we are messing with the state, which is always not recommended). The solution I'd like involves doing the above behind the scenes. I don't know if that is possible, but I suspect to be so (since, like I said before, Snowflake allows you to change schema names without any table replacement).
The text was updated successfully, but these errors were encountered: