home User Guide Getting Started Help Center Documentation Community Training Certification
menu
close
settings
language keyboard_arrow_down
English
Français
Deutsch
日本語
search
print
SqlQuery : Run and Manage SQL Runner Queries

Get SQL Runner Query

GET/api/3.0/sql_queries/{slug}
sql_query(slug)

Implementation Notes

Get a SQL Runner query.

Response Class

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

Parameters

Parameter Required? Description Parameter Type Data Type
slug true slug of query string string

Response Messages

HTTP Status Code Reason Response Model
400 Bad Request
Error {
message (string, read-only, required): Error details,
documentation_url (string, read-only, required): Documentation link
}
404 Not Found
Error {
message (string, read-only, required): Error details,
documentation_url (string, read-only, required): Documentation link
}

Create SQL Runner Query

POST/api/3.0/sql_queries
create_sql_query(body)

Implementation Notes

Create a SQL Runner query.

Response Class

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

Parameters

Parameter Required? Description Parameter Type Data Type
body true SQL Runner Query body
SqlQueryCreate {
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 Messages

HTTP Status Code Reason Response Model
400 Bad Request
Error {
message (string, read-only, required): Error details,
documentation_url (string, read-only, required): Documentation link
}
404 Not Found
Error {
message (string, read-only, required): Error details,
documentation_url (string, read-only, required): Documentation link
}
409 Resource Already Exists
Error {
message (string, read-only, required): Error details,
documentation_url (string, read-only, required): Documentation link
}
422 Validation Error
ValidationError {
message (string, read-only, required): Error details,
errors (Array[ValidationErrorDetail], read-only): Error detail array,
documentation_url (string, read-only, required): Documentation link
}
ValidationErrorDetail {
field (string, read-only): Field with error,
code (string, read-only): Error code,
message (string, read-only): Error info message,
documentation_url (string, read-only, required): Documentation link
}
429 Too Many Requests
Error {
message (string, read-only, required): Error details,
documentation_url (string, read-only, required): Documentation link
}
Top