Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GBQ: rewrite table with a POST request

Exploring Loading data to GBQ with POST request I haven't found how to rewrite existing table (current examples append data to existing table or create new table if it doesn't exist). I see that there is a possibility to do it with web console so I assume there is a way to resolve this task with POST request. Are there someone who knows it?

like image 969
Anastasiia Kharchenko Avatar asked Mar 28 '26 23:03

Anastasiia Kharchenko


1 Answers

You should set WRITE_TRUNCATE value for configuration.load.writeDisposition property of job configuration

configuration.load.writeDisposition string [Optional] Specifies the action that occurs if the destination table already exists.

The following values are supported:
WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result.
The default value is WRITE_APPEND.

Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.

like image 103
Mikhail Berlyant Avatar answered Apr 01 '26 07:04

Mikhail Berlyant



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!