BigQuery does not allow adding columns after dropping

Viewed 41

I have created BQ table with two columns: col1 string nullable col2 string required

And next populated table with some dummy data:

insert into `test.test` values ('val1', 'val2')
insert into `test.test` values (null, 'val2')
insert into `test.test` values ('val1', 'val2')

After that I dropped single column:

Alter table `test.test` drop column col2

And after that I would like to add new column:

alter table `test.test` add column col3 string

HINT: New column that I am trying to add is named differently than the one I deleted. BQ raises an error to me:

Column `col2` was recently deleted in the table `test`. Deleted column name is reserved for up to the time travel duration, use a different column name instead.

It seems to be not right. I know that deleted columns is still kept somewhere in BQ world, but I am trying to add column with different name than the deleted one.

Any idea?

1 Answers

This is a known issue and is being worked upon by Bigquery Engineering team. You may click on +1 to bring more attention on the issue and STAR the issue so that you can be notified for updates.

Meanwhile, as a workaround you try adding new field via

  1. BigQuery UI

  2. bq command line

  3. API or Client Library

Related