Azure SQL - Update
On this Page
Snap type: | Write | ||||||
---|---|---|---|---|---|---|---|
Description: | This Snap executes a SQL update using the input document. Keys from the document will be used as the columns to update and their values will be the updated value in the column. While trying to access a column name that contains specific characters as supported by Azure SQL such as $, #, @ etc., such field names should be enclosed in the square brackets. ETL Transformations & Data FlowThis Snap enables the following ETL operations/flows:
Input & Output
| ||||||
Prerequisites: | This Snap supports SQL Server 2008 or newer. | ||||||
Limitations and Known Issues: | Works in Ultra Tasks. | ||||||
Configurations: | Account & AccessThis Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. See Azure SQL Account for information on setting up this type of account. Views
| ||||||
Troubleshooting: | The section describes typical issues you may encounter while using this Snap, and instructions on how to workaround them:
| ||||||
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 | This is the name of the Azure SQL database that includes the table that will be updated. If this is not specified then the Table Name should be fully qualified with the database name. Optionally, the value can use double quotation marks as an identifier. The values can be passed using the pipeline parameters but not the upstream parameter. Example: SalesData Example: "SalesData" | ||||||
Table Name | Required. This is the table that will be updated. It can be specified as the table name only if the Schema Name is defined. Otherwise, it can be specified as a fully qualified name "Database"."Table". Optionally, the value can use double quotation marks as an identifier. The values can be passed using the pipeline parameters but not the upstream parameter. Example: ProductInfo Example: "SalesData"."ProductInfo" | ||||||
Update Condition | 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:
Instead of building multiple Snaps with inter dependent DML queries, it is recommended to use the Stored Procedure or the Multi Execute Snap.
Examples: Without using expressions
Using expressions
Caution 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. | ||||||
Snap execution | Select one of the three modes in which the Snap executes. Available options are:
|
Typical Snap Configurations
The key Snap configurations:
- Without Expressions
In the below pipleine, the Snap updates the table, "dbo"."AV_EMP" with the given condition, EMPID = 500.
- With Expressions
- Upstream
- Pipeline Parameters
In the below pipeline, the Update Snap retrieves the values from the upstream as well as from the Pipeline parameters.
The Mapper Snap maps the values to be passed using the output schema:
The Azure SQL update Snap uses the value for the table name as passed in the pipeline parameters (_TableTo BeUsed), and the value for the update condition as passed via the upstream.
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, Update functionality can be used. Pipeline download link below.
This pipeline reads and moves the records from the SQL Server table to update the Azure SQL database. The records (EmployeeID, Salary, title) from a table on the SQL Server database are moved to the table on the Azure SQL. The Bulk Load Snap loads the table, while the Update Snap updates the values using an upstream.
Extract: The SQL Server Snap retrives the records from a table on the SQL Server database.
Transform: The Mapper Snap maps the values to be updated on the Azure SQL table.
Load: The Azure SQL Bulk Load Snap loads the data into the Azure SQL database.
Load: The Azure SQL Update Snap updates the table on the Azure SQL.
Read: The Azure SQL Execute Sanp reads the values as updated on the table.
Downloads
Important steps to successfully reuse Pipelines
- Download and import the pipeline into the SnapLogic application.
- Configure Snap accounts as applicable.
- Provide pipeline parameters as applicable.