Method: jobs.getQueryResults

RPC to get the results of a query job.

HTTP request

GET https://bigquery.googleapis.com/bigquery/v2/projects/{projectId}/queries/{jobId}

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
projectId

string

Required. Project ID of the query job.

jobId

string

Required. Job ID of the query job.

Query parameters

Parameters
startIndex

string (UInt64Value format)

Zero-based index of the starting row.

pageToken

string

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

maxResults

number

Maximum number of results to read.

timeoutMs

number

How long to wait for the query to complete, in milliseconds, before returning. Default is 10 seconds. If the timeout passes before the job completes, the 'jobComplete' field in the response will be false.

location

string

The geographic location of the job. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.

Request body

The request body must be empty.

Response body

If successful, the response body contains data with the following structure:

Response object of jobs.getQueryResults.

JSON representation
{
  "kind": string,
  "etag": string,
  "schema": {
    object (TableSchema)
  },
  "jobReference": {
    object (JobReference)
  },
  "totalRows": string,
  "pageToken": string,
  "rows": [
    {
      object
    }
  ],
  "totalBytesProcessed": string,
  "jobComplete": boolean,
  "errors": [
    {
      object (ErrorProto)
    }
  ],
  "cacheHit": boolean,
  "numDmlAffectedRows": string
}
Fields
kind

string

The resource type of the response.

etag

string

A hash of this response.

schema

object (TableSchema)

The schema of the results. Present only when the query completes successfully.

jobReference

object (JobReference)

Reference to the BigQuery Job that was created to run the query. This field will be present even if the original request timed out, in which case jobs.getQueryResults can be used to read the results once the query has completed. Since this API only returns the first page of results, subsequent pages can be fetched via the same mechanism (jobs.getQueryResults).

totalRows

string (UInt64Value format)

The total number of rows in the complete query result set, which can be more than the number of rows in this single page of results. Present only when the query completes successfully.

pageToken

string

A token used for paging results. When this token is non-empty, it indicates additional results are available.

rows[]

object (Struct format)

An object with as many results as can be contained within the maximum permitted reply size. To get any additional rows, you can call jobs.getQueryResults and specify the jobReference returned above. Present only when the query completes successfully.

The REST-based representation of this data leverages a series of JSON f,v objects for indicating fields and values.

totalBytesProcessed

string (Int64Value format)

The total number of bytes processed for this query.

jobComplete

boolean

Whether the query has completed or not. If rows or totalRows are present, this will always be true. If this is false, totalRows will not be available.

errors[]

object (ErrorProto)

Output only. The first errors or warnings encountered during the running of the job. The final message includes the number of errors that caused the process to stop. Errors here do not necessarily mean that the job has completed or was unsuccessful.

cacheHit

boolean

Whether the query result was fetched from the query cache.

numDmlAffectedRows

string (Int64Value format)

Output only. The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/bigquery
  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/bigquery.readonly
  • https://www.googleapis.com/auth/cloud-platform.read-only

For more information, see the Authentication Overview.

Try it!

Czy ta strona była pomocna? Podziel się z nami swoją opinią:

Wyślij opinię na temat...