Skip to main content

SQL Scripts Panel

When specifying on-demand or scheduled outputs, you can define SQL scripts to execute before data ingestion, after output publication, or both. These scripts can be executed through any database connection to which you have write access.

Note

This feature may need to be enabled by a workspace administrator. For more information, see Workspace Settings Page.

When specifying your output, you can choose to add SQL scripts.

SQLScriptsPanel.png

Figure: SQL Scripts panel

Columns:

  • Connection: The name of the connection where the script is to be executed.

  • SQL statement: The first part of the SQL statement to be executed.

  • Settings:

    • Run before data ingest: during job execution, script is to be run before data is ingested for job execution.

    • Run after data publish: during job execution, script is to be run after job has been executed and data is published.

      Note

      If publishing job fails, then all downstream tasks also fail, including the SQL script, which is not executed and is recorded as a failed phase of the job execution.

Actions:

  • Add Script: To add a new SQL script for this output, click Add Script. See below.

  • Edit: To modify the SQL script, highlight the entry and click Edit.

  • Delete: To removal the SQL script, highlight the entry. Then, click More menu > Delete.

Add SQL Script Window

Enter your SQL statement in the window.

AddSQLScriptWindow.png

Figure: Add SQL Script window

Steps:

  1. Select the connection through which to apply the SQL statement.

  2. Enter your SQL statements in the window:

    Note

    Each line must end with a semi-colon (;). Validation fails if otherwise.

    1. You may enter multi-statement SQL scripts.

    2. SQL lines in an individual script are executed in the order listed in the script.

    3. Your SQL statements must comply with the expected syntax of the target system. For more information, see Supported SQL Syntax.

  3. Choose when to run the SQL script:

    1. Run before data ingest: SQL script is executed before the data is ingested for a job run.

    2. Run after data publish: SQL script is executed after that data has been published from a job run.

  4. To validate your SQL, click Validate SQL.

  5. To add the SQL script, click Add.

If you have defined multiple scripts of the same type (before data ingest, for example), those scripts may be executed in parallel.

Note

The order of listing of scripts in the Trifacta Application does not affect the order of execution of those scripts.

For more information on managing SQL scripts, see Create Output SQL Scripts.