Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this Page

Table of Contents
maxLevel2
excludeOlder Versions|Additional Resources|Related Links|Related Information

Snap Type:

Write

Description:

This Snap executes a SQL delete with the given properties.

ETL Transformations & Data Flow

This Snap enables the following ETL operations/flows:

Snap will delete all the records from the input table when there is no WHERE clause in the Delete condition provided or it will delete only the specific records matching with the WHERE clause provided in the properties.

Input & Output

  • InputThis Snap can have an upstream Snap that can pass a document output view. Such as Structure or JSON Generator.
  • Output: The Snap outputs one document specifying the status as success, along with the count of records that are being deleted from the table. Any error occuring during the process is routed to the error view.


Prerequisites:

None.

Limitations and Known Issues:

Works in Ultra Task Pipelines.

Multiexcerpt include macro
nameRedshift limitation with PostgreSQL driver
templateData[]
pageRedshift - Execute
addpanelfalse

Configurations:

Account and Access

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

Views

InputThis Snap has exactly one input view. 
OutputThis Snap has no output views.
Error

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


Troubleshooting:None at this moment

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. Selecting a schema filters the Table name list to show only those tables within the selected schema. The property is suggestible and will retrieve available database schemas during suggest values.

Note

The values can be passed using the pipeline parameters but not the upstream parameter.


Table name


Required. Table name to execute the delete on,

Note

The values can be passed using the pipeline parameters but not the upstream parameter.


Example: people

Delete Condition (Truncates Table if emptycondition (deletes all records from table if left blank)

This is an expression property to specify the SQL WHERE clause of the delete statement. The delete condition may also be passed via an upstream Snap or through the pipeline parameters.

Note

Specify a valid WHERE clause for the delete condition. If you leave this field blank, the Snap truncates deletes all the records from the table.

Examples

Without using expressions

Using expressions

  • "EMPNO=$EMPNO and ENAME=$EMPNAME"

  • email = $email 

  • emp=$emp

  • "emp='" + $emp + "'"

  • "EMPNO=" + $EMPNO + " and ENAME='" + $EMPNAME+ "'"


Warning
titleCaution

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:  [None]

Number of retries

Specifies the maximum number of attempts to be made to receive a response. The request is terminated if the attempts do not result in a response.

Example: 3

Default value: 0

Multiexcerpt include macro
nameretries
pageFile Reader

Retry interval (seconds)

Specifies the time interval between two successive retry requests. A retry happens only when the previous attempt resulted in an exception. 

Example:  10

Default value: 1

Multiexcerpt include macro
nameSnap Execution
pageSOAP Execute

Multiexcerpt include macro
nameExecution_Detail_Write
pageSOAP Execute

Troubleshooting

Multiexcerpt include macro
nameRedshift_Troubleshooting
templateData[]
pageRedshift - Bulk Load
addpanelfalse


Examples

Basic Use Case



The following pipeline describes how the Snap functions as a standalone Snap in a pipeline:

In the pipeline below, the Redshift Delete Snap deletes all the records in the demo_rs_teja1 table belonging to the prasanna schema. All the records are deleted since there is no WHERE clause specified in the Delete condition


In the image below a "success" message can be seen denoting the successful execution of the Snap.


Typical Snap Configurations



The key configuration of the Snap lies in how you pass the SQL statements to delete Redshift records. SQL statements can be passed:

  • Without Expression

The pipeline below shows a configuration where a Mapper Snap is used to pass Key-Value pair to the Redshift Delete Snap. 

The image below shows the configuration of the Mapper Snap, here the $id parameter is assigned the value 1.

The image below shows the configuration of the Redshift Delete Snap. Note the Delete condition id>$id. When executed all the records in the table kzhou2 within the prasanna schema where the id is more than 1 will be deleted.



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



  • With Expression
    • Pipeline Parameter: Pipeline parameters set to pass the required Schema name and Table name to the Redshift Delete Snap.


   


Upon execution, the table belonging to the schema, both passed as pipeline parameters Test Schema and Test Table, will be deleted by the Redshift Delete Snap.  

Advanced Use Case


The following describes a pipeline, with a broader business logic involving multiple ETL transformations, that shows how typically in an enterprise environment, Redshift Delete functionality is used. Pipeline download link below (Downloads Section).  

The below pipeline extracts the records from the MySQL database and transfers them to the Redshift database. The Mapper Snap then maps the input and the Target schemas from the Redshift tables for the records to be deleted. The Redshift Select Snap displays the remaining records.

    

  1. Extract: The MySQL Select Snap retrieves the records from a table on the MySQL database.

  2. Transform: The Mapper Snap maps the input schema to the target schema for the records to be deleted.

  3. Load: The Redshift Bulk Load Snap loads the records into a table on the Redshift database.

  4. Extract: The Redshift Select Snap retrieves the remaining records.


Downloads 

Multiexcerpt include macro
namedownload_instructions
pageOpenAPI

Attachments
oldfalse
patterns.*slp,.*zip


See Also

https://community.snaplogic.com/t/error-on-redshift-delete/10075


Insert excerpt
Redshift Snap Pack
Redshift Snap Pack
nopaneltrue