Google BigQuery

Jobs: getQueryResults

Requires authorization

Retrieves the results of a query job. Try it now.

Required ACLs: To call this method, you must have one of the following sets of rights:

  • Dataset READ

Request

HTTP request

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

Parameters

Parameter name Value Description
Path parameters
jobId string Job ID of the query job
projectId string Project ID of the query job
Optional query parameters
maxResults unsigned integer Maximum number of results to read
pageToken string Page token, returned by a previous call, to request the next page of results
startIndex unsigned long Zero-based index of the starting row
timeoutMs unsigned integer How long to wait for the query to complete, in milliseconds, before returning. Default is to return immediately. If the timeout passes before the job completes, the request will fail with a TIMEOUT error

Authorization

This request requires authorization with at least one of the following scopes (read more about authentication and authorization).

Scope
https://www.googleapis.com/auth/bigquery
https://www.googleapis.com/auth/cloud-platform

Request body

Do not supply a request body with this method.

Response

If successful, this method returns a response body with the following structure:

{
  "kind": "bigquery#getQueryResultsResponse",
  "etag": etag,
  "schema": {
    "fields": [
      {
        "name": string,
        "type": string,
        "mode": string,
        "fields": [
          (TableFieldSchema)
        ],
        "description": string
      }
    ]
  },
  "jobReference": {
    "projectId": string,
    "jobId": string
  },
  "totalRows": unsigned long,
  "pageToken": string,
  "rows": [
    {
      "f": [
        {
          "v": (value),
          "v": string,
          "v": string,
          "v": string,
          "v": string,
          "v": string,
          "v": string,
          "v": string,
          "v": string,
          "v": [
            (TableCell)
          ],
          "v": (TableRow)
        }
      ]
    }
  ],
  "jobComplete": boolean,
  "cacheHit": boolean
}
Property name Value Description Notes
kind string The resource type of the response.
etag etag A hash of this response.
schema nested object The schema of the results. Present only when the query completes successfully.
schema.fields[] list Describes the fields in a table.
schema.fields[].name string [Required] The field name.
schema.fields[].type string [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
schema.fields[].mode string [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
schema.fields[].fields[] list [Optional] Describes the nested schema fields if the type property is set to RECORD.
jobReference nested object 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 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 (GetQueryResults).
jobReference.projectId string [Required] Project ID being billed for the job.
jobReference.jobId string [Required] ID of the job.
totalRows unsigned long 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.
rows[] list An object with as many results as can be contained within the maximum permitted reply size. To get any additional rows, you can call GetQueryResults and specify the jobReference returned above. Present only when the query completes successfully.
rows[].f[] list
rows[].f[].v nested object
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.
pageToken string A token used for paging results.
cacheHit boolean Whether the query result was fetched from the query cache.
schema.fields[].description string [Optional] The field description.

Try it!

Use the APIs Explorer below to call this method on live data and see the response.

المصادقة مطلوبة

يجب أن تسجل دخولك إلى Google+ لتتمكن من إجراء ذلك.

جارٍ تسجيل دخولك...

يحتاج Google Developers إلى إذنك لإجراء ذلك.