Version 4.0.26.22 (latest)

### Get Async Query Results

Returns the results of an async query task if the query has completed.

If the query task is still running or waiting to run, this function returns 202 Accepted.

If the query task ID is invalid or the cached results of the query task have expired, this function returns 404 Not Found.

Use [query_task(query_task_id)](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/methods/Query/query_task) to check the execution status of the query task
Call query_task_results only after the query task status reaches "Complete".

You can also use [query_task_multi_results()](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/methods/Query/query_task_multi_results) retrieve the
results of multiple async query tasks at the same time.

#### SQL Error Handling:

If the query fails due to a SQL db error, how this is communicated depends on the result_format you requested in `create_query_task()`.

For `json_detail` result_format: `query_task_results()` will respond with HTTP status '200 OK' and db SQL error info
will be in the `errors` property of the response object. The 'data' property will be empty.

For all other result formats: `query_task_results()` will respond with HTTP status `400 Bad Request` and some db SQL error info
will be in the message of the 400 error response, but not as detailed as expressed in `json_detail.errors`.
These data formats can only carry row data, and error info is not row data.

## Request

GET /query_tasks/{query_task_id}/results Datatype Description Request HTTP Request path HTTP Path Expand HTTP Path definition... query_task_id string ID of the Query Task

## Response

### 200: The query results.

Datatype Description (string) string

### 202: The query is not finished

Datatype Description (string) string

### 400: Bad Request

Datatype Description (object) [Error](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/Error) message string Error details documentation_url string Documentation link

### 404: The Query Task Id was not found or the results have expired.

Datatype Description (object) [Error](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/Error) message string Error details documentation_url string Documentation link

### 429: Too Many Requests

Datatype Description (object) [Error](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/Error) message string Error details documentation_url string Documentation link

## Examples

### Python


|---|
| [https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/download_dashboard_csv.py](https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/download_dashboard_csv.py#L104 "https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/download_dashboard_csv.py") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/query_task.py](https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/query_task.py#L50 "https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/query_task.py") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/query_task.py](https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/query_task.py#L87 "https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/query_task.py") |