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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[],[],null,["# Create SQL Runner Query\n\nVersion 4.0.25.10\n| **Note:** These docs are for an older version of the API. The API reference is also available for [the latest version, 4.0.25.14](/looker/docs/reference/looker-api/latest).\n\n### Create a SQL Runner Query\n\nEither the `connection_name` or `model_name` parameter MUST be provided.\n\nRequest\n-------\n\nPOST /sql_queries \nDatatype \nDescription \nRequest \nHTTP Request \nbody \nHTTP Body \nExpand HTTP Body definition... \nbody \n[SqlQueryCreate](/looker/docs/reference/looker-api/4.0/25.10/types/SqlQueryCreate) \nSQL Runner Query\nExpand SqlQueryCreate definition... \nconnection_name \nstring \nName of the db connection on which to run this query \nconnection_id \nstring \n(DEPRECATED) Use \\`connection_name\\` instead \nmodel_name \nstring \nName of LookML Model (this or \\`connection_id\\` required) \nsql \nstring \nSQL query \nvis_config \nobject \nVisualization 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.\n\nResponse\n--------\n\n### 200: SQL Runner Query\n\nDatatype \nDescription \n(object) \n[SqlQuery](/looker/docs/reference/looker-api/4.0/25.10/types/SqlQuery) \ncan \n*lock* \nobject \nOperations the current user is able to perform on this object \nslug \n*lock* \nstring \nThe identifier of the SQL query \nlast_runtime \n*lock* \nnumber \nNumber of seconds this query took to run the most recent time it was run \nrun_count \n*lock* \ninteger \nNumber of times this query has been run \nbrowser_limit \n*lock* \ninteger \nMaximum number of rows this query will display on the SQL Runner page \nsql \n*lock* \nstring \nSQL query text \nlast_run_at \n*lock* \nstring \nThe most recent time this query was run \nconnection \n*lock* \n[DBConnectionBase](/looker/docs/reference/looker-api/4.0/25.10/types/DBConnectionBase) \nConnection this query uses\nExpand DBConnectionBase definition... \ncan \n*lock* \nobject \nOperations the current user is able to perform on this object \nname \n*lock* \nstring \nName of the connection. Also used as the unique identifier \ndialect \n*lock* \n[Dialect](/looker/docs/reference/looker-api/4.0/25.10/types/Dialect) \n(Read-only) SQL Dialect details\nExpand Dialect definition... \nname \n*lock* \nstring \nThe name of the dialect \nlabel \n*lock* \nstring \nThe human-readable label of the connection \nsupports_cost_estimate \n*lock* \nboolean \nWhether the dialect supports query cost estimates \ncost_estimate_style \n*lock* \nstring \nHow the dialect handles cost estimation \npersistent_table_indexes \n*lock* \nstring \nPDT index columns \npersistent_table_sortkeys \n*lock* \nstring \nPDT sortkey columns \npersistent_table_distkey \n*lock* \nstring \nPDT distkey column \nsupports_streaming \n*lock* \nboolean \nSupports streaming results \nautomatically_run_sql_runner_snippets \n*lock* \nboolean \nShould SQL Runner snippets automatically be run \nconnection_tests \nstring\\[\\] \nsupports_inducer \n*lock* \nboolean \nIs supported with the inducer (i.e. generate from sql) \nsupports_multiple_databases \n*lock* \nboolean \nCan multiple databases be accessed from a connection using this dialect \nsupports_persistent_derived_tables \n*lock* \nboolean \nWhether the dialect supports allowing Looker to build persistent derived tables \nhas_ssl_support \n*lock* \nboolean \nDoes the database have client SSL support settable through the JDBC string explicitly? \nsnippets \n[Snippet](/looker/docs/reference/looker-api/4.0/25.10/types/Snippet)\\[\\] \nExpand Snippet definition... \nname \n*lock* \nstring \nName of the snippet \nlabel \n*lock* \nstring \nLabel of the snippet \nsql \n*lock* \nstring \nSQL text of the snippet \npdts_enabled \n*lock* \nboolean \nTrue if PDTs are enabled on this connection \nmodel_name \n*lock* \nstring \nModel name this query uses \ncreator \n*lock* \n[UserPublic](/looker/docs/reference/looker-api/4.0/25.10/types/UserPublic) \nUser who created this SQL query\nExpand UserPublic definition... \ncan \n*lock* \nobject \nOperations the current user is able to perform on this object \nid \n*lock* \nstring \nUnique Id \nfirst_name \n*lock* \nstring \nFirst Name \nlast_name \n*lock* \nstring \nLast Name \ndisplay_name \n*lock* \nstring \nFull name for display (available only if both first_name and last_name are set) \navatar_url \n*lock* \nstring \nURL for the avatar image (may be generic) \nurl \n*lock* \nstring \nLink to get this item \nexplore_url \n*lock* \nstring \nExplore page URL for this SQL query \nplaintext \n*lock* \nboolean \nShould this query be rendered as plain text \nvis_config \nobject \nVisualization 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. \nresult_maker_id \nstring \nID of the ResultMakerLookup entry.\n\n### 400: Bad Request\n\nDatatype \nDescription \n(object) \n[Error](/looker/docs/reference/looker-api/4.0/25.10/types/Error) \nmessage \n*lock* \nstring \nError details \ndocumentation_url \n*lock* \nstring \nDocumentation link\n\n### 404: Not Found\n\nDatatype \nDescription \n(object) \n[Error](/looker/docs/reference/looker-api/4.0/25.10/types/Error) \nmessage \n*lock* \nstring \nError details \ndocumentation_url \n*lock* \nstring \nDocumentation link\n\n### 409: Resource Already Exists\n\nDatatype \nDescription \n(object) \n[Error](/looker/docs/reference/looker-api/4.0/25.10/types/Error) \nmessage \n*lock* \nstring \nError details \ndocumentation_url \n*lock* \nstring \nDocumentation link\n\n### 422: Validation Error\n\nDatatype \nDescription \n(object) \n[ValidationError](/looker/docs/reference/looker-api/4.0/25.10/types/ValidationError) \nmessage \n*lock* \nstring \nError details \nerrors \n[ValidationErrorDetail](/looker/docs/reference/looker-api/4.0/25.10/types/ValidationErrorDetail)\\[\\] \nExpand ValidationErrorDetail definition... \nfield \n*lock* \nstring \nField with error \ncode \n*lock* \nstring \nError code \nmessage \n*lock* \nstring \nError info message \ndocumentation_url \n*lock* \nstring \nDocumentation link \ndocumentation_url \n*lock* \nstring \nDocumentation link\n\n### 429: Too Many Requests\n\nDatatype \nDescription \n(object) \n[Error](/looker/docs/reference/looker-api/4.0/25.10/types/Error) \nmessage \n*lock* \nstring \nError details \ndocumentation_url \n*lock* \nstring \nDocumentation link\n\nExamples\n--------\n\n### TypeScript"]]