The Data Synchronization - Write Method document introduces three data writing methods, including Write Data into Target Table Directly, Write Data into Target Table After Emptying It, and Add/Modify/Delete Data Based on Identifier Field.
This document describes the effects of the three methods.
Set Write Method to Write Data into Target Table Directly if the target table has no physical primary key or mapped logical primary key. This approach allows data to be added to the target table without affecting the existing data in the target table.
Scenario Description
The data whose Order ID value is 10282 exists in both the source and target tables.
1. The source table data is shown in the following figure.
2. The target table data is shown in the following figure.
You want to add the source table data to the target table.
Example
1. Create a scheduled task and drag the Data Synchronization node onto the page, as shown in the following figure.
2. Select the target table on the Data Destination and Mapping tab page, as shown in the following figure.
3. Set Write Method to Write Data into Target Table Directly and skip the primary key mapping, as shown in the following figure.
4. Run the task.
The target table data after successful execution is shown in the following figure. The source table data (in the red box) has been added to the target table, including the same data in the source and target tables (marked in yellow).
When the target table has a physical primary key or a mapped logical primary key, the system compares data rows in the source and target tables based on the primary key.
1. The data whose primary key value is different from that of the target table data is added to the target table.
2. Three data writing strategies are provided for data whose primary key value is the same as that of the target table data.
Overwrite Data in Target Table If Same Primary Key Value Exists: Update the target table data.
Ignore Source Data If Same Primary Key Value Exists: Ignore the source table data whose primary key value is the same as that of the target table data.
Record as Dirty Data If Same Primary Key Value Exists: Record the source table data whose primary key value is the same as that of the target table data as dirty data.
1. Configure the data source, the data destination, and the field mapping relationship. The Data Synchronization node is taken as an example in the following figure to illustrate the writing effect. The settings are the same as those in the above section.
2. Set Write Method to Write Data into Target Table Directly, select Order ID as the primary key in Primary Key Mapping, and set Strategy for Primary Key Conflict to Overwrite Data in Target Table If Same Primary Key Value Exists, as shown in the following figure.
The target table data after successful execution is shown in the following figure.
2. Set Write Method to Write Data into Target Table Directly, select Order ID as the primary key in Primary Key Mapping, and set Strategy for Primary Key Conflict to Ignore Source Data If Same Primary Key Value Exists, as shown in the following figure.
The target table data after execution is shown in the following figure.
4. Set Write Method to Write Data into Target Table Directly, select Order ID as the primary key in Primary Key Mapping, and set Strategy for Primary Key Conflict to Record as Dirty Data If Same Primary Key Value Exists, as shown in the following figure.
The running log displays the dirty data prompt, as shown in the following figure.
1. You can set Dirty Data Threshold to allow the scheduled task to continue running despite dirty data until the dirty data limit is reached and an error is triggered. For details, see Task Control - Fault Tolerance Mechanism.
2. If you want a detailed log display, you can set the log level to INFO. For details, see Task Control - Task Attribute.
The system empties the target table before writing data into it.
2. Set Write Method to Write Data into Target Table After Emptying It, as shown in the following figure.
3. Run the task. The target table data after successful execution is shown in the following figure.
You can use this method to perform data inserts, updates, and deletions individually or in combination.
1. In V4.0.28 and later versions, the following scenarios can be implemented by using the Data Synchronization node:
Add/modify/delete the filtered data without the identifier field. (Only one operation type can be selected when the identifier field is empty.)
Add/modify/delete data based on the identifier field and its value.
For details, see Adding/Modifying/Deleting Data Based on the Identifier Field.
2. This writing method is usually used in combination with the Data Comparison operator. For details about specific examples and effects, see Data Comparison Example.
滑鼠選中內容,快速回饋問題
滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。
不再提示
10s後關閉
Submitted successfully
Network busy