query_results
Creates, updates, deletes, gets or lists a query_results
resource.
Overview
Name | query_results |
Type | Resource |
Id | google.bigquery.query_results |
Fields
The following fields are returned by SELECT
queries:
- get_query_results
Successful response
Name | Datatype | Description |
---|---|---|
cacheHit | boolean | Whether the query result was fetched from the query cache. |
errors | array | 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. For more information about error messages, see Error messages. |
etag | string | A hash of this response. |
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. |
jobReference | 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). (id: JobReference) |
kind | string | The resource type of the response. (default: bigquery#getQueryResultsResponse) |
numDmlAffectedRows | string (int64) | Output only. The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE. |
pageToken | string | A token used for paging results. When this token is non-empty, it indicates additional results are available. |
rows | array | 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. The REST-based representation of this data leverages a series of JSON f,v objects for indicating fields and values. |
schema | object | The schema of the results. Present only when the query completes successfully. (id: TableSchema) |
totalBytesProcessed | string (int64) | The total number of bytes processed for this query. |
totalRows | string (uint64) | 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. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get_query_results | select | projectId , +jobId | formatOptions.timestampOutputFormat , formatOptions.useInt64Timestamp , location , maxResults , pageToken , startIndex , timeoutMs | RPC to get the results of a query job. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
+jobId | string | |
projectId | string | |
formatOptions.timestampOutputFormat | string | |
formatOptions.useInt64Timestamp | boolean | |
location | string | |
maxResults | integer (uint32) | |
pageToken | string | |
startIndex | string (uint64) | |
timeoutMs | integer (uint32) |
SELECT
examples
- get_query_results
RPC to get the results of a query job.
SELECT
cacheHit,
errors,
etag,
jobComplete,
jobReference,
kind,
numDmlAffectedRows,
pageToken,
rows,
schema,
totalBytesProcessed,
totalRows
FROM google.bigquery.query_results
WHERE projectId = '{{ projectId }}' -- required
AND +jobId = '{{ +jobId }}' -- required
AND formatOptions.timestampOutputFormat = '{{ formatOptions.timestampOutputFormat }}'
AND formatOptions.useInt64Timestamp = '{{ formatOptions.useInt64Timestamp }}'
AND location = '{{ location }}'
AND maxResults = '{{ maxResults }}'
AND pageToken = '{{ pageToken }}'
AND startIndex = '{{ startIndex }}'
AND timeoutMs = '{{ timeoutMs }}';