I am uploading a JSON file to BigQuery and want to do this weekly. However I want the table to be deleted or have the table emptied. I tried truncating but haven't been able to get that to work. If it isn't removed before re-uploading he data is just added in and then there will be a lot of duplicated info. Thanks for the help.
解决方案
You can't truncate directly.
The --replace parameter to a bq cli load job has the effect you want, clearing out the existing data. Also referred to as WRITE_TRUNCATE when using API mode.
bq load --autodetect --replace --source_format=NEWLINE_DELIMITED_JSON mydataset.mytable gs://mybucket/mydata.json