How to upsert using google-cloud-bigquery gem?
If not possible, how would I achieve it in a Ruby app?
Would I need to create a new table and copy unique rows to it?
How to upsert using google-cloud-bigquery gem?
If not possible, how would I achieve it in a Ruby app?
Would I need to create a new table and copy unique rows to it?
For this purpose look at Bigquery MERGE
clause.
A MERGE statement is a DML statement that can combine INSERT, UPDATE, and DELETE operations into a single statement and perform the operations atomically
A good example for practical usage of this statement you can find in this Stack thread.
I assume for Bigquery Ruby client would be enough appending the MERGE
query statements to the appropriate bigquery.query_job
method ultimately creating a Bigquery Job object.
Having some more doubts/concerns feel free to extend the initial question exploring more context about your current use case.