When initiating a BigQuery job using the BigQuery connector, your workflow might not automatically wait for the job's completion. If subsequent steps depend on the job's success, you should implement a polling mechanism.
Many Workflows connectors return a
long-running operation (LRO) resource that can
be polled. While some connectors return a resource of type Operation to
represent an LRO, BigQuery uses a
Job resource
for this purpose. Other services, such as Cloud Build or Compute Engine,
return an actual Operation resource. For a list of the LRO resource types, see
Supported connectors.
Automatic polling
You can automatically poll for the completion of a BigQuery job
when using connector methods that return an LRO resource, such as
googleapis.bigquery.v2.jobs.insert.
When you use such a connector method, Workflows blocks the
workflow execution until the operation succeeds or fails. The connector_params
field lets you customize the polling behavior, including the total timeout and
the frequency of status checks. For more information, see
Invoke a connector call.
For example, the following workflow demonstrates starting a BigQuery
job using the jobs.insert method, and configuring the job's polling with a
policy that uses custom settings rather than the default settings:
YAML
JSON
Manual polling
Automatic polling only applies to methods that return an LRO resource. Standard
synchronous methods like
googleapis.bigquery.v2.jobs.query
don't support automatic polling and might require
manual polling if the query takes
longer than the internal API timeout.
For example, the following workflow demonstrates how to poll for the completion
of a BigQuery job directly within the workflow by using the
getQueryResults method: