In this article
Table of Contents | ||||
---|---|---|---|---|
|
Overview
This Snap executes a SQL update with the given properties. Document keys will be used as the columns to update, and their values will be used as the updated value.
Note |
---|
Updates will be batched up until the account's batch size property or until the structure of the update statement changes. An update statement will change if an incoming document contains different keys than a previous document. |
Snap Type
Write
Prerequisites
None.
Limitations and Known Issues
None.
Support for Ultra Pipelines
Works in Ultra Pipelines.
Snap Views
Type | Format | Number of Views | Examples of upstream and downstream Snaps | Description |
---|---|---|---|---|
Input | Document |
|
|
|
Copy Snap
Sequence Snap
| Values to be updated in the target columns. | |
Output | Document |
|
None
| Updated records. | |||||
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 while running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:
Learn more about Error handling in Pipelines. |
Snap Settings
Label* | 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, then the suggestion for the Table Name will retrieve all tables names of all schemas. This field is suggestible and will retrieve available database schemas during suggest values.
Default value: [None] | |||||||||||||||
Table name* | The name of the table to execute the update operation on.
Default value: [None] | |||||||||||||||
Update condition* | The condition to execute an update on.
Examples:
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.
Default value: 0 | |||||||||||||||
Retry interval (seconds) | Specifies the time interval between two successive retry requests. A retry happens only when the previous attempt resulted in an exception.
Default value: 1 | |||||||||||||||
|
|
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Examples
Expand | ||
---|---|---|
| ||
In this example, we will update a record in a table.
This example updates a row of data in table TEST_EMPLOYEE which is defined as below:
We need to change the Title column of the row that has "Cooper" as Employee_Name to "Senior Software Engineer". First we use a JSON Generator Snap to pass the new data:
Then we set up the table name and the update condition: This is an example output of the pipeline:
|
Expand | ||
---|---|---|
| ||
In this example, we will see how error handling works. We are using the same pipeline as the one used in Example #1. The difference is this time we try to update the column "Titlee" which doesn't exist in TEST_EMPLOYEE table:
And this is the error message routed to the error view:
|
Expand | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
In this example, we will use the well-known Northwind sample database. Following is a selection from the "Customers" table:
Assume we wish to update the customer "Alfreds Futterkiste" with a new contact person and city. Enter Customers in the Table name property and CustomerName='Alfreds Futterkiste' in the Update condition property. Assume that the Update Snap receives a Map data in the input view as following:
and submit the request to the database server.
|
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|