Aviv Noy
Aviv Noy

Reputation: 576

How to update big tables on google Big Query

What is the best practice for "updating" tables on Google BigQuery?

I get massive batch files that need to be loaded every hour.

Some of the records in the batch files contain records that need to replace the old ones in the big target table.

Upvotes: 3

Views: 1252

Answers (1)

Felipe Hoffa
Felipe Hoffa

Reputation: 59155

If you have an id for each record, you can merge the new table and old table like this:

SELECT * FROM 
  (SELECT * FROM [oldtable] WHERE id NOT IN (SELECT id FROM [newtable])),
  (SELECT * FROM [newtable])

Upvotes: 1

Related Questions