Effect Description of Different Write Methods

  • Last update: December 13, 2024
  • Overview

    The Data Synchronization - Write Method document introduces three data writing methods, including Write Data into Target Table DirectlyWrite 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.

    iconNote:
    This document only introduces the effects of the three data writing methods. For details about specific data update schemes, see Overview of Data Synchronization Schemes.

    Writing Data into the Target Table Directly

    Writing Data into the Target Table With No Physical PK or Mapped Logical PK

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

    Writing Data into the Target Table with a Physical PK or a Mapped Logical PK

    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.

    iconNote:
    This section applies to the scenario where the target table requires data inserts and updates.

    Scenario Description

    1. The source table data is shown in the following figure.

    2. The target table data is shown in the following figure.

    Example

    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 target table data after execution is shown in the following figure.

    The running log displays the dirty data prompt, as shown in the following figure.

    iconNote:

    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.


    Writing Data into the Target Table After Emptying It

    The system empties the target table before writing data into it.

    iconNote:
    This method may cause the target table to be temporarily unavailable.

    Scenario Description

    1. The source table data is shown in the following figure.

    2. The target table data is shown in the following figure.

    Example

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

    Adding/Modifying/Deleting Data Based on the Identifier Field

    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.


    附件列表


    主题: Data Development - Scheduled Task
    Previous
    Next
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy