Teradata Execute
In this article
- 1 Overview
- 1.1 Snap Type
- 1.2 Prerequisites
- 1.3 Support for Ultra Pipelines
- 1.4 Known Issues
- 1.5 Behavior Change
- 2 Snap Views
- 3 Snap Settings
- 3.1 Troubleshooting
- 3.2 Example
Overview
This Snap allows you to execute a Teradata statement. It works only with single queries and supports simple DML (SELECT, INSERT, UPDATE, DELETE) type statements. If a select query is executed, the query's results are merged into the incoming document, and any existing keys will have their values overwritten. On the other hand, the original document is written if there are no results from the query.
You can drop your database with it, so be cautious.
Snap Type
The Teradata Execute Snap is a Write-type Snap.
Prerequisites
A valid account with the required permissions.
Support for Ultra Pipelines
Works in Ultra Pipelines.
Known Issues
Creating stored procedures is not supported with Execute Snap. However, you can only invoke the existing stored procedures.
Behavior Change
In 4.26, when the stored procedures were called using the Database Execute Snaps, the queries were treated as write queries instead of read queries. So the output displayed message and status keys after executing the stored procedure.
In 4.27, all the Database Execute Snaps run stored procedures correctly, that is, the queries are treated as read queries. The output now displays message key, and OUT params of the procedure (if any). The status key is not displayed.If the stored procedure has no OUT parameters then only the message key is displayed with value success. If you have any existing Pipelines that are mapped with status key or previous description then those Pipelines will fail. So, you might need to revisit your Pipeline design.
Snap Views
Type | Format | Number of Views | Examples of Upstream and Downstream Snaps | Description |
|---|---|---|---|---|
Input | Document
|
|
| This Snap has at most one document input view. If the input view is defined, then the where clause can substitute incoming values for a given expression. |
Output | Document
|
|
| This Snap has at most one document output view. 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 statement executed. Valid JSON paths that are defined in the where clause for queries/statements will be substituted with values from an incoming document. |
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
Label*
| Specify the name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your Pipeline. Default Value: Teradata Execute | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
SQL statement*
| Specify the SQL statement to execute on the server. There are two possible scenarios that you encounter when working with SQL statements in SnapLogic. You must understand the following scenarios to successfully execute your SQL statements: Scenarios to successfully execute your SQL statements Scenario 1: Executing SQL statements without expressions
For example: Additionally, the JSON path is allowed only in the WHERE clause. If the SQL statement starts with SELECT (case-insensitive), the Snap regards it as a select-type query and executes once per input document. If not, it regards it as write-type query and executes in batch mode. Scenario 2: Executing SQL queries with expressions
Table name and column names must not be provided as bind parameters. Only values can be provided as bind parameters. For example:
Single quotes in values must be escaped Any relational database (RDBMS) treats single quotes ( For example:
Default Value: [None] | |||||||||
Query type | 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. Default Value: Auto | |||||||||
Query band | Specify the name-value pairs to use in the session's generated query band statement. The query band is passed to the Teradata database as a list of name-value pairs separated by semi-colons. Default Value: N/A | |||||||||
Pass through
| Select this checkbox to pass the input document to the output view under the key 'original'. This property applies only to the Execute Snaps with SELECT statement. Default Value: Selected | |||||||||
Ignore empty result
| 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. Default Value: Not selected | |||||||||
Number of retries | 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:
Default Value: 0 | |||||||||
Retry interval | Specify the time interval between two successive retry requests. A retry happens only when the previous attempt resulted in an exception. | |||||||||
Auto commit | Select one of the options for this property to override the state of the Auto commit property on the account. The Auto commit at the Snap-level has three values: True, False, and Use account setting. The expected functionality for these modes are:
Default Value: Use account setting '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. In those cases, “Auto commit" in Snap property should be set to ‘False’ and the Fetch size in the “Account setting" can be increased for optimal performance. Behavior of DML Queries in Database Execute Snap when auto-commit is false DDL queries used in the Database Execute Snap will be committed by the Database itself, regardless of the Auto-commit setting. | |||||||||
Advanced options | Select the option ‘Timestamp with microsecond precision’ to support the microsecond precision for TIMESTAMP data type. The SELECT query for TIMESTAMP columns produces string values with microsecond precision in the output documents. Default Value: None | |||||||||
Troubleshooting
Error | Reason | Resolution |
|---|---|---|
| A syntax error was found in the QUERY_BAND. | Verify that the query band is in the format specified in the Query band field above. For example, if |
Example
This example demonstrates how to execute various commands using the Teradata Execute Snap. This pipeline creates a table, inserts the data into the table, and reads the data using the respective execute commands (CREATE, INSERT, and SELECT).
1. Create a table, Snaplogic.character_datatype under the schema name Snaplogic. The table has 4 columns: INTEGER, CHAR, VARCHAR and CLOB .
2. Insert the required data into the table Snaplogic.character_datatype using the Teradata Execute Snap.
3. We use the Teradata Execute Snap again and select the data from the table Snaplogic.character_datatype1 using the SELECT command.
Successful execution of the Pipeline displays the following preview:
Have feedback? Email documentation@snaplogic.com | Ask a question in the SnapLogic Community
© 2017-2025 SnapLogic, Inc.