Skip to main content

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​

InputTypeRequiredDefaultWhat it is
Workspace address (URL)StringNoWorkspace address, e.g. https://adb-1234567890123456.7.azuredatabricks.net or https://dbc-a1b2c3d4-e5f6.cloud.databricks.com.
Warehouse IDStringYesSQL warehouse that runs the statement: its name or its id (from its Connection details).
SQL statementStringYesSQL to run.
ParametersDictionaryNoValues for :name markers in the SQL, e.g. {"region": "EMEA"}.
CatalogStringNoCatalog for names that are not fully written out.
SchemaStringNoSchema for names that are not fully written out.
Wait (seconds)NumberNo600How long to wait for the result before returning with status RUNNING.
Maximum rowsNumberNo100000Most rows to bring back into the table.
Access tokenCredentialNoDatabricks 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 IDStringNoApplication (client) id of a service principal, to sign in with OAuth instead of a personal access token (G6).
Client secretCredentialNoThe service principal's OAuth secret from the vault (G6).

Outputs​

OutputTypeWhat it is
tableTableResult rows (empty for statements that return no rows).
row_countNumberNumber of rows in the table.
statement_idStringId of the statement, for status, results or cancel.
statusStringSUCCEEDED, or PENDING / RUNNING when it did not finish within the wait time.