How to update all columns when using BigQuery DML

Viewed 908

I have a Bigquery table that I want to periodically update with new data. I was thinking of using another table and a UPDATE query, but it seems I have to specify all the columns I want to update.

UPDATE
  dataset.t t
SET
  my_column = u.my_column
 ...
FROM
  dataset.u u
WHERE
  t.my_key = u.my_key

Is there a way to write a query that will update all fields from the destination table? I have a lot of them.

1 Answers

It doesn't seem to be possible. For a MERGE query, you can use INSERT ROW but there is no UPDATE ROW. I ended up listing all columns this way:

UPDATE
  dataset.t t
SET
  my_column = u.my_column
 ...
FROM
  dataset.u u
WHERE
  t.my_key = u.my_key
Related