Teradata Select
Overview
The Teradata Select Snap fetches data from a Teradata database by providing a table name and configuring the connection.
The Snap produces the records from the database on its output view which can then be processed by a downstream Snap.
JSON paths can be used in a query and will have values from an incoming document substituted into the query. However, documents missing values for a given JSON path will be written to the Snap's error view. After a query is executed, the query's results are merged into the incoming document overwriting any existing keys' values. The original document is output if there are no results from the query.
Queries produced by the Snap have the format:
SELECT TOP [limit] * FROM [table] WHERE [where clause] ORDER BY [ordering]
If more powerful functionality is desired, then the Teradata Execute Snap should be used.
SALARY =$SALARY (here we use the SALARY variable of the input document). A bad example for a where clause is: SALARY = _param (this will not work since we do not evaluate pipeline parameters during prepared statement execution, instead an upstream mapper needs to be used that maps _param into $SALARY).- This is a Read-type Snap.
Works in Ultra Tasks
Prerequisites
None.
Snap views
| Type | Description | Examples of upstream and downstream Snaps |
|---|---|---|
| Input |
This Snap has two input views:
|
|
| Output |
This Snap has at most one output view and produces zero or more documents. The Snap outputs one document for every record retrieved. |
|
| Learn more about Error handling. | ||
Snap settings
- Expression icon (
): Allows using pipeline parameters to set field values dynamically (if enabled). SnapLogic Expressions are not supported. If disabled, you can provide a static value.
- SnapGPT (
): Generates SnapLogic Expressions based on natural language using SnapGPT. Learn more.
- Suggestion icon (
): Populates a list of values dynamically based on your Snap configuration. You can select only one attribute at a time using the icon. Type into the field if it supports a comma-separated list of values.
- Upload
: Uploads files. Learn more.
| Field/Field set | Description |
|---|---|
Label
String |
Required. Specify a unique name for the Snap. Modify this to be more appropriate, especially if more than one of the same Snaps is in the pipeline. Default value: Teradata Select |
Schema name
String/Expression/ Suggestion |
The database schema name. In case it is not defined, then the suggestion for the table name will retrieve all tables names of all schemas. The property is suggestable and will retrieve available database schemas during suggest values.
Default value: N/A Example: SYS |
Table name
String/Expression/ Suggestion |
Name of table to execute select query on.
Default value: N/A Example: people |
Where clause
String/Expression |
Where clause of select statement. This supports document value substitution (such as $person.firstname will be substituted with the value found in the incoming document at the path). However, you may not use a value substitution after "IS" or "is" word.
Without using expressions:
Using expressions:
CAUTION: Using expressions that join strings together to create SQL queries or conditions has a potential SQL injection risk and is hence unsafe. Ensure that you understand all implications and risks involved before using concatenation of strings with '=' Expression enabled.
Default value: N/A Example: EMPNO=$EMPNO and ENAME=$EMPNAME |
Order by columns
String/Expression/ Suggestion |
Enter in the columns in order to order by. The default database sort order will be used.
Default value: N/A Example: name, email |
Limit offset
Integer/Expression |
Starting row for the query.
Default value: N/A Example: 0 |
Output fields
String/Expression/ Suggestion |
Enter or select output field names for SQL SELECT statement. To select all fields, leave it at default.
Default value: N/A Example: email, address, first, last |
Query band
String/Expression |
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 Example: ProjectName=dstage1;user=test; |
Fetch Output Fields In Schema
Checkbox |
Select this check box to include only the selected fields or columns in the Output Schema (second output view). If you do not provide any Output fields, all the columns are visible in the output. If you provide output fields, we recommend you to select this check box.
Default value: Deselected |
Pass through
Checkbox |
If checked, the input document will be passed through to the output view under the key 'original'.
Default value: Selected |
Ignore empty result
Checkbox |
If checked, no document will be written to the output view when the SELECT operation does not produce any result. If this property is unchecked and the Pass through property is checked, the input document will be passed through to the output view.
Default value: Deselected |
Auto commit
Dropdown list |
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 |
Snap execution
Dropdown list |
Choose one of the three modes in
which the Snap executes. Available options are:
|
Troubleshooting
| Error | Cause | Resolution |
|---|---|---|
| Failure: Failed to execute query error code: 5992 | A syntax error was found in the QUERY_BAND. | Check that the query band is in the form specified in the Query band field above. For example, if you used priority=1;workload=high in the Query band, add a semi-colon and update the value to priority=1;workload=high;. |