Search code examples
google-bigquery

Can't figure out how to change column type in bigquery


I looked it up and it seems like I can just run a query similar to the one below, however when I execute it, I get the following error: Column not found: struct1.struct2.CurrentlyStringDataType at [2:1]

ALTER TABLE `project.dataset.table`
ALTER COLUMN `struct1.struct2.CurrentlyStringDataType`
SET DATA TYPE INTEGER;

Any idea why this is happening? I used the google doc for this too: https://cloud.google.com/bigquery/docs/managing-tables#sql


Solution

  • Hi @spider based on the error you are getting Column not found: , it may come when your Column is too nested .

    It’s supported when- column_name : The name of the top level column you're altering .

    Modifying subfields is not supported.