Version 4.0.26.22 (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 [SqlQueryCreate](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/SqlQueryCreate) 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) [SqlQuery](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/SqlQuery) 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 [DBConnectionBase](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/DBConnectionBase) 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 [Dialect](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/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 [Snippet](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/Snippet)\[\] 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 project_id string ID of the LookML project to which this connection is scoped. Excluding or passing 'NULL' in this field makes the connection global. Beware that once configured this field cannot be modified. model_name string Model name this query uses creator [UserPublic](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/UserPublic) 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) is_service_account boolean Indicates if this user is a service account. is_embed_user boolean Indicates if this user is an embed user. 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) [Error](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/Error) message string Error details documentation_url string Documentation link

### 404: Not Found

Datatype Description (object) [Error](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/Error) message string Error details documentation_url string Documentation link

### 409: Resource Already Exists

Datatype Description (object) [Error](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/Error) message string Error details documentation_url string Documentation link

### 422: Validation Error

Datatype Description (object) [ValidationError](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/ValidationError) message string Error details errors [ValidationErrorDetail](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/ValidationErrorDetail)\[\] 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) [Error](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/Error) message string Error details documentation_url string Documentation link

## Examples

### TypeScript


|---|
| [https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-codegen/src/kotlin.gen.spec.ts](https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-codegen/src/kotlin.gen.spec.ts#L289 "https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-codegen/src/kotlin.gen.spec.ts") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-codegen/src/python.gen.spec.ts](https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-codegen/src/python.gen.spec.ts#L1074 "https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-codegen/src/python.gen.spec.ts") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-codegen/src/typescript.gen.spec.ts](https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-codegen/src/typescript.gen.spec.ts#L573 "https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-codegen/src/typescript.gen.spec.ts") |