Gustavo Schonhorst
Gustavo Schonhorst

Reputation: 55

Change clustered columns in an existing bigquery table

I have a partitioned and clustered table in bigquery. I would like to add another column to the set of clustered columns. I found out that the way to fix it is creating another table as you can see here Make existing bigquery table clustered, but I can't do it because my table is the source of a Data Studio dashboard where I have many calculated fields and I don't want to lose these fields.

Any suggestion? Thanks a lot!

Gustavo.

Upvotes: 4

Views: 2775

Answers (2)

Yun Zhang
Yun Zhang

Reputation: 5503

You don't need a new table, although changing cluster column was not supported initially, it is supported afterwards (since early 2020).

Please check this documentation: https://cloud.google.com/bigquery/docs/creating-clustered-tables#modifying-cluster-spec

Unfortunately, the feature is only available through API right now.

(If you're not familiar with BigQuery API) It doesn't require you to write code, you can interact with API web interface here. For your one time maintenance, it may save you some time.

Upvotes: 4

Suds
Suds

Reputation: 156

I don't think BigQuery yet allows renaming a table. Can you use view? So copy data to another table with required modified clustering. Then have a view with same name as the old table name on the new table, so that nothing breaks on Data Studio.

Upvotes: 0

Related Questions