GBQ: rewrite table with POST request

Exploring Loading Data into GBQ with POST Request I have not found how to overwrite an existing table (current examples add data to an existing table or create a new table if it doesn't exist). I see there is an option to do this using the web console, so I guess there is a way to accomplish this with a POST request. Does anyone know this?

+3


source to share


1 answer


You must set a value WRITE_TRUNCATE

for configuration.load.writeDisposition

the job config property



configuration.load.writeDisposition string [Optional] Specifies the action to take if the target 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 adds the data to the table. WRITE_EMPTY . If the table already exists and contains data, the job returns a "duplicate" error.
The default is WRITE_APPEND.

Each action is atomic and only occurs if BigQuery can successfully complete the task. The create, truncate, and add actions occur as one atomic update after the job completes.

+2


source







All Articles