API call to bigquery.tables.insert failed with error: Already Exists

375 views Asked by At

I have created a script in GoogleAds to fetch this report: https://developers.google.com/adwords/api/docs/appendix/reports/product-partition-report from GoogleAds and insert the result as a table in BigQuery using the AdvanceAPI in GoogeAds.

The script I am running is built according to this sample code: https://developers.google.com/adwords/api/docs/appendix/reports/product-partition-report, provided by the Google Ads Script Team and they have also tried to help me in this matter.

The issue I am facing is that the first run of the script runs perfectly and creates a table in BQ and inserts the data as intended. However, when the script runs again (as sheduled 3 PM everyday) to get updated data from GoogleAds I get the following error message: API call to bigquery.tables.insert failed with error: Already Exists

The error message also provides the information that the issue is somewhere in this code:

table.tableReference = BigQuery.newTableReference();
table.tableReference.datasetId = CONFIG.BIGQUERY_DATASET_ID;
table.tableReference.projectId = CONFIG.BIGQUERY_PROJECT_ID;
table.tableReference.tableId = reportConfig.NAME;

table = BigQuery.Tables.insert(table, CONFIG.BIGQUERY_PROJECT_ID,
    CONFIG.BIGQUERY_DATASET_ID);

But all this chunk of code is provided from the Google Ads Script Team so there should not be any problem with this?

So happy if someone could give me any guidance how to solve this!

Thanks in advance.

0

There are 0 answers