Hi, I want to change a schema in my Bigquery table...
# getting-started
Hi, I want to change a schema in my Bigquery table. I know that it should be deleted and I'm ok with it. I changed the schema and when I run
pulumi up
, I see this error message:
Copy code
error: deleting urn:pulumi:dev::data::gcp:bigquery/dataset:Dataset$gcp:bigquery/table:Table::my_dataset.my_table: 1 error occurred:
        * cannot destroy instance without setting deletion_protection=false and running `terraform apply`
I changes some resource options:
Copy code
But the error has not been dissapeared. What did I do wrong? How to fix that?
Hi Viktor - I believe the input you want to explicitly set is here: https://www.pulumi.com/registry/packages/gcp/api-docs/sql/databaseinstance/#deletionprotection_nodejs and there's a note in the top description that covers your experience, I believe: https://www.pulumi.com/registry/packages/gcp/api-docs/sql/databaseinstance/#databaseinstance
Hi @shy-arm-32391 I use Bigquery, not Cloud SQL. Your link about is about Cloud SQL. But maybe there is a same thing, I'm going to check. I use this resource: https://www.pulumi.com/registry/packages/gcp/api-docs/bigquery/
ah, my bad! it does seem that it is the same: https://www.pulumi.com/registry/packages/gcp/api-docs/bigquery/table/
I hope that helps! 🙂
It works! When combined with
. Thanks so much!
Hi guys, sorry to chime in that topic but I couldn’t get answer from other channels. @rough-oyster-77458, Do you know if there is a way to add columns a table in Bigquery without recreate table and not touching the underlying data?
Hi @breezy-glass-7721 No problem. I use
object to create and update tables. It consumes
parameter to control the schema, where we should put a JSON string with a schema. When I just add a new column schema to the JSON, it creates a new column in the existing table without recreating the table. And it works pretty fine for me. But if you want to change a column (for example, when you decide you want to change
field type from STRING to INT), I'm afraid Pulumi will recreate the whole table. And this is a limitation of Bigquery, as well as most other column oriented data bases. It's not a limitation of Pulumi.
Thank you so much Viktor! It is really helpful
We use native api for GCP. Does it make difference?
Not much, I guess
But be careful - the native provider is not stable