简体   繁体   中英

Automated Apps Script for BigQuery Not Connecting To Right Project?

I'm getting the below problem with apps script which is attempting to run a query and create a table, TEST4, in BigQuery. The error is:

"Project 603804914871 is not found and cannot be used for API calls. (line 19, file "Code")"

Query is:

saveQueryToTable() {
      var projectId = 'fiery-cabinet-****';
      var datasetId = '11234***1';
      var tableId = 'TEST4';
      var job = {
        configuration: {
          query: {
            query: 'SELECT *' +
                   'FROM Test2;',
            destinationTable: {
              projectId: projectId,
              datasetId: datasetId,
              tableId: tableId
            }
          }
        }
      };

  var queryResults = BigQuery.Jobs.insert(job, projectId);
  Logger.log(queryResults.status);
}

Could anyone let me know where I'm going wrong?

I can find that project in my console, I can enable the bigquery API for that project and then I don't get any errors... however it doesn't run the query or save to a new table "TEST4"?

Response from @KENDi was correct. I had to enable the API in the Google Developer Console.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM