User Guide Getting Started Help Center Documentation Community Training
  
English
日本語
SqlQuery : Run and Manage SQL Runner Queries

Get SQL Runner Query beta

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

Implementation Notes

Get a SQL Runner query.

Response Class

SqlQuery {
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,
can (object, read-only): Operations the current user is able to perform on this object
}
DBConnectionBase {
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,
can (object, read-only): Operations the current user is able to perform on this object
}
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,
supports_upload_tables (boolean, read-only): Whether the dialect supports uploading tables,
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,
can (object, read-only): Operations the current user is able to perform on this object
}
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 {
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,
can (object, read-only): Operations the current user is able to perform on this object
}

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 beta

POST/api/3.0/sql_queries
create_sql_query(body)

Implementation Notes

Create a SQL Runner query.

Response Class

SqlQuery {
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,
can (object, read-only): Operations the current user is able to perform on this object
}
DBConnectionBase {
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,
can (object, read-only): Operations the current user is able to perform on this object
}
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,
supports_upload_tables (boolean, read-only): Whether the dialect supports uploading tables,
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,
can (object, read-only): Operations the current user is able to perform on this object
}
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 {
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,
can (object, read-only): Operations the current user is able to perform on this object
}

Parameters

Parameter Required? Description Parameter Type Data Type
body true SQL Runner Query body
SqlQueryCreate {
connection_id (string): Id of Connection (this or "model_name" required),
model_name (string): Name of LookML Model (this or "connection_id" required),
sql (string): SQL query,
can (object, read-only): Operations the current user is able to perform on this object
}

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
}
Top