简体   繁体   中英

How to overwrite column values in bigquery existing table

I need to overwrite/update column values in bigquery. The problem with solution bellow is it loads lots of data every time need to upload few records. Need a more optimal solution which will only upload the id's that matches.

Extra: it would be even better if it could check if the value is the same, if not it doesn't update the record. I would think it would reduce even more with load

table 1:

name   id    value
jose   1     10
jack   5     15
lex    4   12

table 2:

id   value
1    200
2    200
3    700
4    800
5    200

Query:

select
t1.name,
t1.id,
t2.value

from table 1 as t1
left join table2 as t2
on t1.id=t2.id

The example in the link bellow creates a new table, so doesn't work. It need to update values in the existing table.

changing column values in bigquery

You got this wrong.

In BigQuery you pay what you read and not what you write. So if you need to read a lot of rows to compare, for every read you pay, and the write is free. So you should reduce with a WHERE logic the number of items you "read" to reduce your costs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM