# Databricks - Run custom SQL action

This action lets you send a SQL string to you Databricks instance for execution. It can be used to run Data Manipulation Language (DML) statements like INSERT, UPDATE, SELECT and DELETE, as well as Data Definition Language (DDL) commands, like CREATE, ALTER and DROP.

Run custom SQL actionRun custom sql action

This action is not optimized for easy configuration. For SELECT statements with a large number of columns, use the Select rows using custom SQL action instead.


# Input fields

To use this action, configure the following input fields.

  • SQL

  • Provide the SQL query, including meaningful column aliases. The query is used to generate the output datatree. To do this, the SQL is executed when you provide it.
    Use bind variables (for example,id = :id) and the parameter field to parameterize inputs. You must manually define the schema when you use bind variables.

    CLAUSES TO AVOID

    Avoid using restrictive clauses like LIMIT or TOP(N) in your SQL.

  • Parameters

  • This field is used in conjunction with your WHERE condition. First, declare the named bind variables in your WHERE input. Next, assign values to these variables using this input field. Parameter values can be static or datapills. Select the closest corresponding data type that your database is expecting for the bind variable.

  • Output fields

  • Use this field to define the columns returned in your query. Workato does this dynamically, but you can use this field to override any columns in case of errors. The name of the fields defined here must match the column names in your query exactly.


# Output

This action generates the following output.

  • rows

  • A JSON array of objects. Each object describes one row of the selected data.

  • rows_affected

  • The number of rows added/updated.

  • rows_count

  • The number of rows returned.


Last updated: 4/5/2023, 2:25:23 AM