Jobs: getQueryResults

Requires authorization

Retrieves the results of a query job.

Access control: To call this method, you must have one of the following dataset roles:

For more information, see access control.


HTTP request



Parameter name Value Description
Path parameters
jobId string [Required] Job ID of the query job
projectId string [Required] Project ID of the query job
Optional query parameters
location string The geographic location where the job should run. Required except for US and EU. See details at
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 10 seconds. If the timeout passes before the job completes, the 'jobComplete' field in the response will be false


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


Request body

Do not supply a request body with this method.


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": [
        "description": string
  "jobReference": {
    "projectId": string,
    "jobId": string,
    "location": 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": [
          "v": (TableRow)
  "totalBytesProcessed": long,
  "jobComplete": boolean,
  "errors": [
      "reason": string,
      "location": string,
      "debugInfo": string,
      "message": string
  "cacheHit": boolean,
  "numDmlAffectedRows": long
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. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters.
schema.fields[].type string [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
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] The ID of the project containing this job.
jobReference.jobId string [Required] The ID of the job. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 characters.
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 Represents a single row in the result set, consisting of one or more fields.
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. For more information, see query caching.
schema.fields[].description string [Optional] The field description. The maximum length is 1,024 characters.
totalBytesProcessed long The total number of bytes processed for this query.
errors[] list [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.
errors[].reason string A short error code that summarizes the error.
errors[].location string Specifies where the error occurred, if present.
errors[].debugInfo string Debugging information. This property is internal to Google and should not be used.
errors[].message string A human-readable description of the error.
numDmlAffectedRows long [Output-only] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.
jobReference.location string The geographic location of the job. See details at

Try it!

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

¿Te sirvió esta página? Envíanos tu opinión:

Enviar comentarios sobre…