Get Query

Version 4.0.24.16

Get a previously created query by id.

A Looker query object includes the various parameters that define a database query that has been run or could be run in the future. These parameters include: model, view, fields, filters, pivots, etc. Query results are not part of the query object.

Query objects are unique and immutable. Query objects are created automatically in Looker as users explore data. Looker does not delete them; they become part of the query history. When asked to create a query for any given set of parameters, Looker will first try to find an existing query object with matching parameters and will only create a new object when an appropriate object can not be found.

This 'get' method is used to get the details about a query for a given id. See the other methods here to 'create' and 'run' queries.

Note that some fields like 'filter_config' and 'vis_config' etc are specific to how the Looker UI builds queries and visualizations and are not generally useful for API use. They are not required when creating new queries and can usually just be ignored.

Request

GET /queries/{query_id}
Datatype
Description
Request
HTTP Request
path
HTTP Path
Expand HTTP Path definition...
query_id
string
Id of query
query
HTTP Query
Expand HTTP Query definition...
fields
string
Requested fields.

Response

200: Query

Datatype
Description
(object)
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

400: Bad Request

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

404: Not Found

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