Get Async Query Results

Version 4.0.24.16 (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 204 No Content.

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) 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() 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: query_task

Datatype
Description
(object)
can
object
Operations the current user is able to perform on this object
id
string
Unique Id
query_id
string
Id of query
query
Query
Expand Query definition...
can
object
Operations the current user is able to perform on this object
id
string
Unique Id
model
string
Model
view
string
Explore Name
fields
string[]
pivots
string[]
fill_fields
string[]
filters
object
Filters will contain data pertaining to complex filters that do not contain "or" conditions. When "or" conditions are present, filter data will be found on the `filter_expression` property.
filter_expression
string
Filter Expression
sorts
string[]
limit
string
Limit
column_limit
string
Column Limit
total
boolean
Total
row_total
string
Raw Total
subtotals
string[]
vis_config
object
Visualization configuration properties. These properties are typically opaque and differ based on the type of visualization used. There is no specified set of allowed keys. The values can be any type supported by JSON. A "type" key with a string value is often present, and is used by Looker to determine which visualization to present. Visualizations ignore unknown vis_config properties.
filter_config
object
The filter_config represents the state of the filter UI on the explore page for a given query. When running a query via the Looker UI, this parameter takes precedence over "filters". When creating a query or modifying an existing query, "filter_config" should be set to null. Setting it to any other value could cause unexpected filtering behavior. The format should be considered opaque.
visible_ui_sections
string
Visible UI Sections
slug
string
Slug
dynamic_fields
string
Dynamic Fields
client_id
string
Client Id: used to generate shortened explore URLs. If set by client, must be a unique 22 character alphanumeric string. Otherwise one will be generated.
share_url
string
Share Url
expanded_share_url
string
Expanded Share Url
url
string
Expanded Url
query_timezone
string
Query Timezone
has_table_calculations
boolean
Has Table Calculations
generate_links
boolean
whether or not to generate links in the query response.
force_production
boolean
Use production models to run query (even is user is in dev mode).
path_prefix
string
Prefix to use for drill links.
cache
boolean
Whether or not to use the cache
server_table_calcs
boolean
Whether or not to run table calculations on the server
cache_only
boolean
Retrieve any results from cache even if the results have expired.
cache_key
string
cache key used to cache query.
status
string
Status of query task.
source
string
Source of query task.
runtime
number
Runtime of prior queries.
rebuild_pdts
boolean
Rebuild PDTS used in query.
result_source
string
Source of the results of the query.
look_id
string
Id of look associated with query.
dashboard_id
string
Id of dashboard associated with query.
result_format
string
The data format of the query results.

204: The query is not finished

Datatype
Description
(string)
string

400: Bad Request

Datatype
Description
(object)
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)
message
string
Error details
documentation_url
string
Documentation link

429: Too Many Requests

Datatype
Description
(object)
message
string
Error details
documentation_url
string
Documentation link

Examples