Run SQL statement
Run SQL on a SQL warehouse and return the rows as a data table. Use :name in the SQL for values passed in parameters.
Command in the Databricks toolkit · id ooa.databricks/execute_sql · 11 inputs (2 required), 4 outputs
Inputs
| Input | Type | Required | Default | What it is |
|---|---|---|---|---|
| Workspace address (URL) | String | No | Workspace address, e.g. https://adb-1234567890123456.7.azuredatabricks.net or https://dbc-a1b2c3d4-e5f6.cloud.databricks.com. | |
| Warehouse ID | String | Yes | SQL warehouse that runs the statement: its name or its id (from its Connection details). | |
| SQL statement | String | Yes | SQL to run. | |
| Parameters | Dictionary | No | Values for :name markers in the SQL, e.g. {"region": "EMEA"}. | |
| Catalog | String | No | Catalog for names that are not fully written out. | |
| Schema | String | No | Schema for names that are not fully written out. | |
| Wait (seconds) | Number | No | 600 | How long to wait for the result before returning with status RUNNING. |
| Maximum rows | Number | No | 100000 | Most rows to bring back into the table. |
| Access token | Credential | No | Databricks personal access token or OAuth token from the vault. Or leave it empty and choose a connection that signs in, which gets and renews the token. | |
| Client ID | String | No | Application (client) id of a service principal, to sign in with OAuth instead of a personal access token (G6). | |
| Client secret | Credential | No | The service principal's OAuth secret from the vault (G6). |
Outputs
| Output | Type | What it is |
|---|---|---|
| table | Table | Result rows (empty for statements that return no rows). |
| row_count | Number | Number of rows in the table. |
| statement_id | String | Id of the statement, for status, results or cancel. |
| status | String | SUCCEEDED, or PENDING / RUNNING when it did not finish within the wait time. |