Rebecca
Rebecca

Reputation: 77

BigQuery - Move from a synchronous job to an asynchronous job

After a certain time, I would like to make a synchronous job (launched with jobs.query) asynchronous (as if it were launched with jobs.insert) but I don't want to launch a new job. Is it possible?

Upvotes: 0

Views: 432

Answers (1)

kode
kode

Reputation: 384

When you say jobs.query here I'm assuming you're referring bigquery rest api. One approach to make your query job async, referring to their doc, is as below:

  1. specify a minimum timeoutMs property in QueryRequest while preparing query POST request, so that you request does not wait till query finishes i.e. become synchronous
  2. after you POSTing the query, past minimum timeout value, you'll receive response with a JobReference attribute
  3. use the jobId from JobReference to track/poll status of your query at later time asynchronously

And if you refer to not-rest api approaches such as for Java or Python languages, they have out-of-the-box api specifically to execute the query synchronously or asynchronously.

Upvotes: 1

Related Questions