get_query_results
Get the results of a BigQuery SQL query job.
Use this tool ONLY when:
A previous
execute_sqlorexecute_sql_readonlycall returnedjob_complete: falsewith ajob_id(poll with this tool untiljob_complete: true), ORYou need to paginate through additional rows using
page_tokenorstart_indexfor a previously completed job.
Do NOT call this tool if the query already returned job_complete: true with all rows.
Supports pagination. Use max_results to limit results and page_token to retrieve the next page of results.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| jobId | Yes | Required. Job ID of the query job. | |
| location | No | Optional. The geographic location of the job. | |
| pageToken | No | Optional. Page token, returned by a previous call, to request the next page of results. | |
| projectId | Yes | Required. Project ID of the query job. | |
| timeoutMs | No | Optional. Specifies the maximum amount of time, in milliseconds, that the client is willing to wait for the query to complete. | |
| maxResults | No | Optional. Maximum number of results to read. | |
| startIndex | No | Optional. Zero-based index of the starting row. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | No | 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. | |
| jobId | No | Output only. The ID of the BigQuery job created for this query, if any. Present when a query job is created (e.g. for long-running operations, DML, scripts). Use this ID with `get_query_results`, `cancel_job`, or `get_job`. | |
| errors | No | 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](https://cloud.google.com/bigquery/docs/error-messages). | |
| schema | No | The schema of the results. Present only when the query completes successfully. | |
| queryId | No | Output only. The ID of the query. | |
| jobComplete | No | 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. | |
| totalSlotMs | No | Output only. Number of slot ms the user is actually billed for. | |
| totalBytesBilled | No | Output only. The total number of bytes billed for the query. Only applies if the project is configured to use on-demand pricing. | |
| numDmlAffectedRows | No | Output only. The number of rows affected by a DML statement. | |
| totalBytesProcessed | No | Output only. The total number of bytes processed for this query. |