ashishk
ashishk

Reputation: 299

How to change the billing tier option in bigquery APIs

I am using bigquery APIs in my google app script something like:

  try {  
   var queryRequest = BigQuery.newQueryRequest();
   queryRequest.setQuery(sql).setTimeoutMs(100000);
   queryResults = BigQuery.Jobs.query(queryRequest, projectNumber);
    // Browser.msgBox(queryRequest);
  }
  catch (err) {
    Logger.log(err);
    Browser.msgBox(err);
    return;
  }
  // Check on status of the Query Job : MONTHLY 
  while (queryResults.getJobComplete() == false) {
    try {
      queryResults = BigQuery.Jobs.getQueryResults(projectNumber, queryResults.jobId);
      //queryResults = BigQuery.Jobs.getQueryResults(projectNumber, job.id);
    }
    catch (err) {
      Logger.log(err);
      Browser.msgBox(err);
      return;
    }
  }

It is giving me:

Exception: Query exceeded resource limits for tier 1. Tier 3 or higher required.

I saw the similar error at cloud.bigquery, when writing the query in bigquery console there I can remove it by selecting the billing tier as unlimited but I don't know how to do it through the API (automated way). Is there any way we can achieve it.

Upvotes: 2

Views: 724

Answers (2)

Mikhail Berlyant
Mikhail Berlyant

Reputation: 173106

Jobs: getQueryResults API just retrieves the results of a query job
The "issue" with billing tier happened before – when you called query job via Jobs: insert API
So, controlling max billing tier should be applied here by using configuration.query.maximumBillingTier property

Upvotes: 1

KENdi
KENdi

Reputation: 7771

You can try to apply for a higher quota in the Developer Console. You can go to Google APIs -> BigQuery API -> Quotas then select for Apply for higher quota. You can also check here the Pricing details and the Big Quota Policy that provides you the maximum Bigquery limit rate of incoming requests and enforces appropriate quotas on a per-project basis.

Upvotes: 0

Related Questions