AlloyDB Delete

Overview

You can use this Snap to execute an SQL delete query.



Behavior changes

  • The following are the behavior changes caused by the JDBC driver upgrade for PostgreSQL Snap Pack and Google AlloyDB Snap Pack
  • Some error messages will now include the data type for certain values, for example:
    • Old: "...where (badId = 1) was aborted:..."

    • New:
      "...where (badId = ('1'::numeric)) was
          aborted:..."
  • There are some minor text changes to a few of the error messages, for example:
    • Old:
      "Hint: No operator matches the given name and argument
            types."
    • New:
      "Hint: No operator matches the given name and argument
          type(s)."

Snap views

View Description Examples of upstream and downstream Snaps
Input WHERE clause for the delete condition.
Output The status of the deleted object.
  • Optional
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. The available options are:

  • Stop Pipeline Execution Stops the current pipeline execution when an error occurs.
  • Discard Error Data and Continue Ignores the error, discards that record, and continues with the remaining records.
  • Route Error Data to Error View Routes the error data to an error view without stopping the Snap execution.

Learn more about Error handling in Pipelines.

Snap settings

Legend:
  • 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.
Learn more about the icons in the Snap settings dialog.
Field / Field set Type 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: AlloyDB Delete

Example: AlloyDB Delete
Schema Name String/Expression

The database schema name. Selecting a schema filters the Table name list to show only those tables within the selected schema.

Default value: N/A

Example: demo

Table name String/Expression/ Suggestion Required. Table name to execute the delete on.
Note: The values can be passed using the pipeline parameters but not the upstream parameter.

Default value: N/A

Example: test_table

Delete condition (deletes all records from table if left blank) String/Expression Specify a valid WHERE clause for the delete condition. The delete condition may also be passed through an upstream Snap or through the Pipeline parameters.

The document field values can be substituted into the WHERE clause by providing the path. For example, $person.firstname would insert the field 'firstname' from the 'person' object into the query (firstname == $person.firstname would become firstname == 'Joe' if $person.firstname evaluates to 'Joe').

Note: If you leave this field blank, the Snap deletes all the records from the table.
Warning: Using expressions that join strings together to create SQL queries or conditions has a potential SQL injection risk and is therefore unsafe. Ensure that you understand all implications and risks involved before using concatenation of strings with '=' Expression enabled.

Here is an example of a delete statement.

Default value: N/A

Example:

Without using expressions
Using expressions
  • "EMPNO=$EMPNO and ENAME=$EMPNAME"

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

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

Number of Retries Integer/Expression Specify the time interval between two successive retry requests. A retry happens only when the previous attempt resulted in an exception.

Default value: 0

Example: 3

Retry Interval (Seconds) Integer/Expression Specify the time interval between two successive retry requests. A retry happens only when the previous attempt resulted in an exception.

Default value: 1

Example: 10

Snap execution Dropdown list
Choose one of the three modes in which the Snap executes. Available options are:
  • Validate & Execute: Performs limited execution of the Snap and generates a data preview during pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during pipeline runtime.
  • Execute only: Performs full execution of the Snap during pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Default value: Execute only

Example: Validate & Execute