Azure Synapse SQL Update

Overview

You can use this Snap to update existing records in the target tables with the specified conditions. Document keys are used as the column update, and their values are used as the updated column value.

Note: The updates are batched until the account's Batch size field, or the structure of the update statement changes. An update statement changes if an incoming document contains different keys than a previous document.

Azure Synapse SQL Update Snap Overview

Prerequisites

A valid Azure Synapse SQL Account with the required permissions.

Limitations

When the table name contains single quote characters, the No table found error is displayed. This is because of the JDBC driver limitation.

Known issues

None.

Behavior changes

The jOOQ upgrade for the Azure Synapse SQL Snap Pack from v3.9.1 to v3.17.x resulted in the following behavior:

Previously, when "null"(string) was passed from the upstream Mapper Snap for the Bigint datatype, the Azure Synapse SQL Update Snap updated it as null without displaying any error. It displayed the status as 0 and the output message as Success. Now, the Snap displays the following error in this scenario: Error converting value (expecting a number but you are sending String("null"))

Snap views

Type Description Examples of upstream and downstream Snaps
Input

A document containing the data to be updated in the table.

Output

Document containing the number of records updated.

Learn more about Error handling.

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 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: Azure Synapse SQL Update

Example: Azure Synapse SQL Update
Schema Name

String/Expression

Specify the database schema name. If it is not defined, then the suggestion for the Table Name retrieves all tables names of all schemas. The property is suggestible and retrieves available database schemas during suggest values.

Note: The values can be passed using the Pipeline parameters but not the upstream parameter.

Default value: N/A

Example: SYS

Table Name

String/Expression

Required.Specify the name of the table to update records in.

Default value: N/A

Example: Employee

Update Condition

String/Expression

Specify the SQL WHERE clause of the update statement. You can define specific values or columns to update (Set condition) in the upstream Snap, such as Mapper Snap, and then use the WHERE clause to apply these conditions on the columns sourced from the upstream Snap. For instance, here is a sample of an Update SQL query:

UPDATE table_name
SET column1 = value1, column2 = value2,
WHERE condition;
Note: If the Update Condition field is left blank, the condition is applied on all the records of the target table.
Note:

In specific scenarios where you want to use specific data from the upstream Snaps, and do not want to change that data in the Update Snap, then you need to place the data in the original structure of the input document. Therefore, we recommend that you use the format for the Update condition and input data format as shown below:

{
"valueToUpdate" : "true",
"original": {
"col1" : "KEY"
}
}

Refer to the example to understand how to use the Update Condition.

Default value: N/A

Example:

Without using expressions

Using expressions

  • "EMPNO=$EMPNO and ENAME=$EMPNAME"
  • email = $email
  • emp=$emp
  • "emp='" + $emp + "'"
  • "EMPNO=" + $EMPNO + " and ENAME='" + $EMPNAME+ "'"
Warning: 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.
Number of Retries

Integer/Expression

Specify 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.

Default value: 0

Example: 3

Retry Interval (seconds)

Integer/Expression

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

Default value: 1

Example: 10