Here is a code I am using as a reference from https://cloud.google.com/bigquery/docs/managing-tables#bigquery-copy-table-python:
source_dataset = client.dataset('samples', project='bigquery-public-data')
source_table_ref = source_dataset.table('shakespeare')
# dataset_id = 'my_dataset'
dest_table_ref = client.dataset(dataset_id).table('destination_table')
job = client.copy_table(
source_table_ref,
dest_table_ref,
# Location must match that of the source and destination tables.
location='US') # API request
job.result() # Waits for job to complete.
In my case the destination table exists and I get this error:
Already Exists
How can I overwrite with this copy_table method? In the bq commandline, I can use -f option. So I am looking for the same flag.