Skip to end of banner
Go to start of banner

TPT Delete

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Snap type:

Write

 

Description:

The TPT (Teradata Parallel Transport) Delete Snap allows you to delete the data  by executing the script generated using the upstream document provided by the user.  The Snap deletes the table data with the values provided in the input view and using the delete condition provided in the Delete Condition property, and provides the console output, status code and summary on the output view for any downstream Snap checking for successful execution. 


Queries produced by the Snap have the format:

DELETE FROM CUSTOMER WHERE CUSTOMER_NUMBER LT 100000;

Give the delete Condition as follows: 

empno  LT : empno ( Where : empno is the  place holder which internally represents $empno value coming from the upstream component)
empno < :empno

Allows logical operators like GE (Greater than or equals), GT (Greater than), LT (Less than), LE(Less than or equals), IS NULL, IS NOT NULL etc..
Allows < , > , <=, >= etc.  


The TPT Snaps are built to handle the bulk input documents. The TPT Delete Snap is designed to execute only if there are input documents. The Snap does not to execute when there is no input document. 

The equalTo '=' operator is not allowed to use with a PI (Primary Index) column. However, if the table has more than one PI columns, you can use them as partial PI columns.


  • Expected upstream Snaps: Any Snap that provides a document output view, such as Structure or a JSON Generator Snap.
  • Expected downstream Snaps: Any Snap with a document input view
  • Expected input: A stream of documents to be loaded into the table. Each input document contains values for one record in the table.
  • Expected output: A single document containing the console output, return status from tbuild and the script which the Snap submitted to tbuild.

 

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, these respective utilities should be installed/available on the Snapplexes.

 

Basic steps for installing the TPT utilities:

Procedure to install the Teradata tools and utilities:

  • Download the Teradata Tools and Utilities base such as TeradataToolsAndUtilitiesBase__Linux_i386-x8664.15.10.06.00.tar.gz for Linux environment.
  • If the OS is 64 bit,  install 32 bit support packages on the environment and also any further dependencies
  • Install the Teradata Tools and Utilities (that includes tbuild, fastload, mload etc)
  • The default installation also configures the PATH in the OS

Flow:  If tbuild or fastload is already available in the OS path then the corresponding TPT Snap can call the utility, however, if these binaries are not available in the OS path, then we need to provide the absolute path of the respective binary in the Snap.


Support and limitations:

 

Account: 

This Snap uses account references created on the Accounts page of  SnapLogic Manager to handle access to this endpoint. See Teradata Database Account for information on setting up this type of account.

 

Views:
InputThis Snap has at most one Document view.
OutputThis Snap has at most one output view.
Error

This Snap has at most one error view and produces zero or more documents in the view. 

A single document containing the console output and return status from the external TPT application for each input document

 

 

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.

 

Schema name

 

 

The database schema name. In case it is not defined,  the suggestion for the table name will retrieve all the table names of all the schemas. The property is suggestible and will retrieve available database schemas during suggest values.

Example: SYS

Default value: [None] 

Table name

Required. Name of the table to insert records into.

Example: people

Default value: [None] 

TBUILD Location

 

Location of the tbuild application.
Note: The location will be on the Snapplex.

Example: /usr/bin/tbuild

Default value: [None]

Delete Condition

 

Delete Statement to be executed to delete the table data which matches given delete condition. If no condition specified in the Delete Condition field then entire table data will be deleted from the specified database. Please note that, due to Teradata's requirement, an equality operator '=' is not allowed with PI (Primary Index). For example, if 'empno' is a PI, "empno=:empno" will cause an error "RDBMS error 3537: A MultiLoad DELETE Statement is Invalid."

Example:  empno < 1000
                     empno LT :empno

Default value: [None] 

Execute during preview

 

Executes the Snap during a pipeline Save operation so that the output view can produce the preview data.

Default value: Not Selected 


Example


 In this pipeline, the TPT Delete Snap deletes the TPT table items by providing a delete query condition. The TPT Insert Snap inserts the values into the TPT records via the upstream JSON Generator Snap. 

 

 

The upstream JSON Generator Snap supplies the values to be inserted into the records of the target TPT Table. The respective output preview is as displayed:


 

The TPT insert Snap inserts the values into the records of the TPT table Table Delete under the schema, ADW SNAPL. Additionally provide the Fetch metadata delay field with a time of 5secs to avoid the conflict of parallel TPT executions in the pipeline. 

 

 

 

The output preview at the TPT Insert Snap is as displayed below: 


 

 

The Mapper Snap maps the values to the target path, here, the value 103 is mapped to the column empno.


 

The TPT Delete Snap deletes the items from the table, "ADW_SNAPL"."Delete_Table item1" by  providing the delete condition, empno > :empno which deletes all the items that have the empno greater than the value 103. Leave the Delete Condition field empty if the entire table needs to be deleted. 

 

The successful execution of the pipeline displays the below output preview:

(Note that the two rows having the value greater than103 have been deleted from the table)

 

Snap History

4.8.0

  • Introduced the Snap in this release.

  • No labels