Create SQL Runner Query

Version 4.0.24.18 (latest)

Create a SQL Runner Query

Either the connection_name or model_name parameter MUST be provided.

Request

POST /sql_queries
Datatype
Description
Request
HTTP Request
body
HTTP Body
Expand HTTP Body definition...
body
SQL Runner Query
Expand SqlQueryCreate definition...
connection_name
string
Name of the db connection on which to run this query
connection_id
string
(DEPRECATED) Use `connection_name` instead
model_name
string
Name of LookML Model (this or `connection_id` required)
sql
string
SQL query
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.

Response

200: SQL Runner Query

Datatype
Description
(object)
can
object
Operations the current user is able to perform on this object
slug
string
The identifier of the SQL query
last_runtime
number
Number of seconds this query took to run the most recent time it was run
run_count
integer
Number of times this query has been run
browser_limit
integer
Maximum number of rows this query will display on the SQL Runner page
sql
string
SQL query text
last_run_at
string
The most recent time this query was run
connection
Connection this query uses
Expand DBConnectionBase definition...
can
object
Operations the current user is able to perform on this object
name
string
Name of the connection. Also used as the unique identifier
dialect
(Read-only) SQL Dialect details
Expand Dialect definition...
name
string
The name of the dialect
label
string
The human-readable label of the connection
supports_cost_estimate
boolean
Whether the dialect supports query cost estimates
cost_estimate_style
string
How the dialect handles cost estimation
persistent_table_indexes
string
PDT index columns
persistent_table_sortkeys
string
PDT sortkey columns
persistent_table_distkey
string
PDT distkey column
supports_streaming
boolean
Supports streaming results
automatically_run_sql_runner_snippets
boolean
Should SQL Runner snippets automatically be run
connection_tests
string[]
supports_inducer
boolean
Is supported with the inducer (i.e. generate from sql)
supports_multiple_databases
boolean
Can multiple databases be accessed from a connection using this dialect
supports_persistent_derived_tables
boolean
Whether the dialect supports allowing Looker to build persistent derived tables
has_ssl_support
boolean
Does the database have client SSL support settable through the JDBC string explicitly?
snippets
Expand Snippet definition...
name
string
Name of the snippet
label
string
Label of the snippet
sql
string
SQL text of the snippet
pdts_enabled
boolean
True if PDTs are enabled on this connection
model_name
string
Model name this query uses
creator
User who created this SQL query
Expand UserPublic definition...
can
object
Operations the current user is able to perform on this object
id
string
Unique Id
first_name
string
First Name
last_name
string
Last Name
display_name
string
Full name for display (available only if both first_name and last_name are set)
avatar_url
string
URL for the avatar image (may be generic)
url
string
Link to get this item
explore_url
string
Explore page URL for this SQL query
plaintext
boolean
Should this query be rendered as plain text
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.
result_maker_id
string
ID of the ResultMakerLookup entry.

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

409: Resource Already Exists

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

422: Validation Error

Datatype
Description
(object)
message
string
Error details
Expand ValidationErrorDetail definition...
field
string
Field with error
code
string
Error code
message
string
Error info message
documentation_url
string
Documentation link
documentation_url
string
Documentation link

429: Too Many Requests

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

Examples