Redshift - Execute
In this article
Overview
You can use the Redshift Execute Snap to execute arbitrary SQL queries. It executes DML (SELECT, INSERT, UPDATE, DELETE) type statements. This Snap works best with single queries.
Snap type
The Redshift Execute Snap is a Write-type Snap that writes the results of the executed SQL queries.
Prerequisites
Redshift database environment and Redshift database account with valid access control.
Support for Ultra Pipelines
Works in Ultra Pipelines.
Limitations
When the SQL statement property is an expression, the pipeline parameters are shown in the suggest, but not the input schema.
Multiple queries might not work, because the underlying JDBC driver does not support multiple queries. We recommend you to use the Redshift - Multi Execute Snap for running multiple queries.
Behavior Change
Snap Views
Type | Format | Number of Views | Examples of Upstream and Downstream Snaps | Description |
|---|---|---|---|---|
Input | Document |
|
| A Snap that can contain data that is to be used with the JSON paths defined in the SQL, if any, or to be passed through. If the input view is defined, then the where clause substitutes incoming values for a specific query. |
Output | Document
|
|
| A document with the result set output, if any, and update count as return status from the Redshift SQL. The Snap output all records of a batch (as configured in your account settings) to the error view if the write fails during batch processing. If an output view is available and an update/insert/merge/delete statement was executed, then the original document that was used to create the statement will be output with the status of the executed statement. |
Error | Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter when running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab:
Learn more about Error handling in Pipelines. | |||
Snap Settings
Asterisk ( * ): Indicates a mandatory field.
Suggestion icon (): Indicates a list that is dynamically populated based on the configuration.
Expression icon ( ): Indicates the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.
Add icon ( ): Indicates that you can add fields in the field set.
Remove icon ( ): Indicates that you can remove fields from the field set.
Field Name | Field Type | Description |
|---|---|---|
Label*
| String | Specify the name for the Snap. |
SQL statement*
| String/Expression | Specify the SQL statement to execute on the server.
Valid JSON paths that are defined in the WHERE clause for queries/statements are substituted with values from an incoming document. If the document is missing a value to be substituted into the query/statement, it will be written to the error view. If ‘$' is not part of the JSON path, it can be escaped by writing it as Following is an example of the procedure:
|
Query type
Default Value: Auto | Dropdown list/Expression | Select the type of query for your SQL statement (Read or Write). When Auto is selected, the Snap tries to determine the query type automatically. |
Pass through
| Checkbox | Select this checkbox to pass the input document through to the output view under the key 'original'. This property applies only to the Execute Snaps with SELECT statement.
|
Ignore empty result
| Checkbox | Select this checkbox to ignore empty result; no document will be written to the output view when a SELECT operation does not produce any result. |
Number of retries
Default Value: 0 | Integer/Expression | Specify the maximum number of retry attempts the Snap must make in case of network failure. When you set the Number of retries to more than 0, the Snap generates duplicate records when the connection is not established. To prevent duplicate records, we recommend that you follow one of the following:
|
Retry interval (seconds)
Default Value: 1 |
| Specify the time interval between two successive retry requests. A retry happens only when the previous attempt resulted in an exception.
|
Auto commit
| Dropdown list | Select one of the following options:
Auto commit may be enabled for certain use cases if PostgreSQL JDBC driver is used in either Redshift, PostgreSQL or Generic JDBC Snap. But the JDBC driver may cause out of memory issues when Select statements are executed. For such cases, we recommend you to set Auto commit in the Snap settings to False and the Fetch size in the Account settings can be increased for optimal performance. Behavior of DML Queries in the Execute Snap when auto-commit is false
|
Snap Execution
| Dropdown list | Select one of the three modes in which the Snap executes. Available options are:
|
Have feedback? Email documentation@snaplogic.com | Ask a question in the SnapLogic Community
© 2017-2025 SnapLogic, Inc.