Reputation: 4158
I have a Python script (shown below) that runs the query in 'query.txt' and uploads it to google big query. This script has to run every 5 minutes. First time it does correctly, but for the second time, it throws the error "table already exists". I have to override the table if it already exists. I do not find any override option in bq help. Any help would be appreciated.
commandStr = "type C:\Users\sridevibaskaran\query.txt | bq query --destination_table geotab-bigdata-test:TestSridevi.DeviceCarrier_%s -n 1" %(dateToday1)
os.system(commandStr)
print commandStr
Upvotes: 3
Views: 4023
Reputation: 173190
run bq help query
and check replace
flag
--[no]replace: If true, erase existing contents before loading new data. (default: 'false')
Upvotes: 3