Current Situation
I have a bigquery table called orders
containing some columns, and about 0.5 million rows.
What I Need
The table needs to have a new column, called ingestion_time
, of type DATETIME
that would default to the current local time of Singapore (UTC+8h) at the time of ingesting each row.
The default value is necessary to ensure that any process that were inserting into the table, can continue to do so without being aware of the new column.
Question
What’s the easiest and safest way to do it? From a bit of searching, it looks Big query can ALTER
the table to add a new column, but cannot insert a default value for that.
If I create a new table, will it start empty? Or, is there a way to create a new table that carries forward all the rows, and previous columns, and adds a new column with the default value?