TPT Upsert
On this Page
Snap type: | Write | |||||||
---|---|---|---|---|---|---|---|---|
Description: | The TPT (Teradata Parallel Transport) Upsert Snap allows you to update or insert the data from input view by executing the script generated using the fields provided by the user in the Snap fields. The Snap updates the table with the values provided in the input view and using the where clause, provides the console output and status code on the output view for any downstream Snap checking for successful execution. Queries produced by the Snap have the format: UPDATE table_name SET column1=value1,column2=value2,... WHERE some_column=some_value; Â
| |||||||
Prerequisites: | TPT Snaps (TPT Insert, TPT Update, TPT Delete, TPT  Upsert and TPT Load) uses the 'tbuild' utility for the respective operations. In order to use these Snaps in the pipelines, the respective TPT utilities should be installed/available on the Snapplexes. All the required TPT utilities must be installed on the node where JCC is running or the Snap simply executes but may not perform the operation. Any utility/library file missing on the node may cause the Snap to perform a failed operation. | |||||||
Basic steps for installing the TPT utilities: | Procedure to install the Teradata tools and utilities:
Flow:Â Â If the tbuild or fastload is already available on the OS path then the corresponding TPT Snap can invoke the required utility, however, if these binaries are not available on the OS path, then we need to provide the absolute path of the respective binary in the Snap. | |||||||
Support and limitations: | None. | |||||||
Account: | This Snap uses account references created on the Accounts page of  SnapLogic Manager to handle access to this endpoint. See Configuring Teradata Database Accounts for information on setting up this type of account. | |||||||
Views: |
| |||||||
Settings | ||||||||
Label | Required. 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:  TPT Upsert | |||||||
Schema name | 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 suggestible and will retrieve available database schemas during suggest values. The values can be passed using the pipeline parameters but not the upstream parameter. Example: SYS Default value:Â [None]Â | |||||||
Table name | Required. Name of the table to execute the upsert on. The values can be passed using the pipeline parameters but not the upstream parameter. Example: people Default value: [None] | |||||||
TBUILD location | Location of the tbuild application Default value: /usr/bin/tbuild  It will be present on the Snapplex. | |||||||
Fetch metadata delay (seconds) Â | The wait time in seconds to be used before fetching metadata to avoid conflicts while performing Teradata parallel executions in a pipeline. Default value: 0Â | |||||||
Where columns | Required. Where clause of the select statement. Columns to use to in, where a condition of the update query to check for existing entries in the target table, the value for the column is given from the input document. Note that the primary columns should be included in both, the Where columns and the Primary partition columns properties. Example: email Default value: None | |||||||
Primary partition columns | Required. Add all the primary and partition columns for the given table, that are excluded from the "SET" operation as the TPT Script doesn't support the primary or the partition key as update fields. The TPT Update Snap does not support NOPI (No Primary Index) tables. Example: id name Default value: None | |||||||
Snap execution | Select one of the three modes in which the Snap executes. Available options are: Disabled: Disables the Snap and all Snaps that are downstream from it. |
Example
In this pipeline, the values are upserted (updated and inserted) on the target TPT table using the TPT Upsert Snap. The values are passed through the upstream JSON Generator and the Mapper Snaps respectively.
The JSON Generator Snaps passes the values to be updated in the records of the TPT table.Â
The Mapper Snap connected to the input view of the TPT Upsert Snap, maps the values to be updated or inserted  to the respective columns of the table.
Note that the primary key value 'empno' on the Target schema is referenced with a star. This value is supplied in the Where columns and the the Primary Partition columns fields of the TPT Upsert Snap.
The TPT Upsert Snap updates and/or inserts the upstream values on the records of the target table Insert Sample3 under the schema ADW SNAPL.Â
The successful execution of the pipeline displays the below output preview:
Note that in this example, the values are updated in the existing records and no new rows have been created.
Snap Pack History
Have feedback? Email documentation@snaplogic.com | Ask a question in the SnapLogic Community
© 2017-2024 SnapLogic, Inc.