Reputation: 2510
Is there a convenient way (Python, web UI, or CLI) for inserting a new column into an existing BigQuery table (that already has 100 columns or so) and update the schema accordingly?
Say I want to insert it after column 49. If I do this via a query, I will have to type every single column name, will I not?
Update: the suggested answer does not make it clear how this applies to BigQuery. Furthermore, the documentation does not seem to cover
ALTER TABLE `tablename` ADD `column_name1` TEXT NOT NULL AFTER `column_name2`;
Syntax. A test confirmed that the AFTER
identifier does not work for BigQuery.
Upvotes: 0
Views: 1190
Reputation: 835
I think that is not possible to perform this action in a simple way, I thought in some workarounds to reach this such as:
On the other hand, I can't catch how this is useful, the only scenario I can think for this requirement is if you are using SELECT *
which is not recommended when using BigQuery according with the Bigquery best practices. If is not the case share your case of use to get a better understanding of it.
Since this is not a current feature of BigQuery you can file a feature request asking for this feature.
Upvotes: 1