Method: googleapis.bigquery.v2.jobs.getQueryResults

RPC to get the results of a query job. # IAM Permissions Requires the following IAM permission(s) to use this method: - bigquery.jobs.get on the job. - bigquery.tables.getData on the destination table. If the user matches the creator of the job, the following IAM permission(s) are required instead: - bigquery.jobs.create on the project. - bigquery.tables.getData on the destination table.

Arguments

Parameters
jobId

string

Required. Job ID of the query job.

projectId

string

Required. Project ID of the query job.

formatOptions.timestampOutputFormat

enum

Optional. The API output format for a timestamp. This offers more explicit control over the timestamp output format as compared to the existing use_int64_timestamp option.

Enum type. Can be one of the following:
TIMESTAMP_OUTPUT_FORMAT_UNSPECIFIED Corresponds to default API output behavior, which is FLOAT64.
FLOAT64 Timestamp is output as float64 seconds since Unix epoch.
INT64 Timestamp is output as int64 microseconds since Unix epoch.
ISO8601_STRING Timestamp is output as ISO 8601 String ("YYYY-MM-DDTHH:MM:SS.FFFFFFFFFFFFZ").
formatOptions.useInt64Timestamp

boolean

Optional. Output timestamp as usec int64. Default is false.

location

string

The geographic location of the job. You must specify the location to run the job for the following scenarios: * If the location to run a job is not in the us or the eu multi-regional location * If the job's location is in a single region (for example, us-central1) For more information, see how to specify locations.

maxResults

integer (uint32 format)

Maximum number of results to read.

pageToken

string

Page token, returned by a previous call, to request the next page of results.

startIndex

string (uint64 format)

Zero-based index of the starting row.

timeoutMs

integer (uint32 format)

Optional: Specifies the maximum amount of time, in milliseconds, that the client is willing to wait for the query to complete. By default, this limit is 10 seconds (10,000 milliseconds). If the query is complete, the jobComplete field in the response is true. If the query has not yet completed, jobComplete is false. You can request a longer timeout period in the timeoutMs field. However, the call is not guaranteed to wait for the specified timeout; it typically returns after around 200 seconds (200,000 milliseconds), even if the query is not complete. If jobComplete is false, you can continue to wait for the query to complete by calling the getQueryResults method until the jobComplete field in the getQueryResults response is true.

Raised exceptions

Exceptions
ConnectionError In case of a network problem (such as DNS failure or refused connection).
HttpError If the response status is >= 400 (excluding 429 and 503).
TimeoutError If a long-running operation takes longer to finish than the specified timeout limit.
TypeError If an operation or function receives an argument of the wrong type.
ValueError If an operation or function receives an argument of the right type but an inappropriate value. For example, a negative timeout.

Response

If successful, the response contains an instance of GetQueryResultsResponse.

Subworkflow snippet

Some fields might be optional or required. To identify required fields, refer to the API documentation.

YAML

- getQueryResults:
    call: googleapis.bigquery.v2.jobs.getQueryResults
    args:
        jobId: ...
        projectId: ...
        formatOptions:
            timestampOutputFormat: ...
            useInt64Timestamp: ...
        location: ...
        maxResults: ...
        pageToken: ...
        startIndex: ...
        timeoutMs: ...
    result: getQueryResultsResult

JSON

[
  {
    "getQueryResults": {
      "call": "googleapis.bigquery.v2.jobs.getQueryResults",
      "args": {
        "jobId": "...",
        "projectId": "...",
        "formatOptions": {
          "timestampOutputFormat": "...",
          "useInt64Timestamp": "..."
        },
        "location": "...",
        "maxResults": "...",
        "pageToken": "...",
        "startIndex": "...",
        "timeoutMs": "..."
      },
      "result": "getQueryResultsResult"
    }
  }
]