-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BigQuery table schema update fails/tries to replace the table if a column gets removed #12441
Comments
@nbali did you review the limitation on the schema below? https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/bigquery_table#schema |
@edwardmedia I did, and I get why is it like that, BUT I don't see how is that relevant on the long term though. IMO it's not a limitation that can't be worked around. It's just a limitation that hasn't been handled in a more thorough manner. YET. Both values are JSONs. They can be diffed, merged, etc. This config would require the current and the expected schema to be merged together (if a column is missing from the expected schema, but present in the current, add it to the expected), and applied on table. It will still fail if the update is not doable (like changing type from record to integer), but it wouldn't fail due to the "deprecated" columns. |
@nbali are you able to create a config with resources (not module) that can be reproed the issue? |
@edwardmedia I have updated the issue with original + modified config, and the received output. |
@nbali somehow I can't repro the issue. Are you able to run from the
Did I miss anything here in repro? |
Well I think you missed probably the most important business aspect of this issue. The table should never be dropped, and that deletion protection should never be turned off. I mean doesn't it just drops the table and creates a new one in that case? That is an even worse scenario than to unable to update a schema. |
@nbali I do see tables.patch is available. But by the time this resource was implemented, only
|
@edwardmedia "this is by design" |
@nbali I am quoting the content from the link I provided here
Again tables.patch wasn't available and recreation was by design. Still have questions? |
To request the change to use |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
Affected Resource(s)
Terraform Configuration Files
original config
modified config
Debug Output
Panic Output
Expected Behavior
There should be a config ( for example ignore_unknown_columns ) to influence what to do with columns that has been removed from the TF config.
At the 8th step in "Steps to Reproduce" terraform should either fail/try to replace it (if we have no new config, just like now), or it should successfully apply the changes, and still keep the columns in BQ that aren't present anymore in the TF schema (if the new config gets enabled).
Actual Behavior
At the 8th step in "Steps to Reproduce" terraform fails. See "Debug Output".
Steps to Reproduce
IMO this is a quite common pattern, that people mirror/ingest/capture something from another system into BQ, and just because the source of the data doesn't have/fill a certain column anymore, the users / scripts / etc might still need that field even if it contains values only for older entries.
Important Factoids
I wanted to emphasize here, that I was torn between this being a bug or an enhancement. I chose bug, because it prevent such a common use-case, and tries to solve it in a catastrophically wrong way (table replacement).
References
The text was updated successfully, but these errors were encountered: