Full data synchronization

Updated at:

You can create an offline auto triggered task that automatically creates tables for full data synchronization by selecting a registered data source and a destination. This topic describes how to create a one-time offline task to sync full data from MySQL to MaxCompute.

Prerequisites

  1. You have created a workspace group. For more information, see Create a workspace group.

  2. You have added MaxCompute and ApsaraDB RDS for MySQL data sources to the workspace group. For more information, see Add a compute resource.

  3. You have obtained the physical tables from the data source. For more information, see Obtain a physical table.

  4. The ApsaraDB RDS for MySQL data source contains the ys_yhkh table to use as the source table for data synchronization. For the table schema and data, see RDS script.

Procedure

  1. Log on to the Data Resource Platform console.

  2. In the upper-left corner of the page, choose 菜单 > Collaboration.

  3. In the top menu bar, click the 选择工作组 icon and select the target workspace group.

  4. In the navigation pane on the left, click 数据同步.png > Offline Data Synchronization.

  5. On the Offline Data Synchronization page, click Add Task.

  6. On the Offline Data Synchronization management page, configure the offline auto triggered task.

    1. Fill in the basic information. Set Task Name to Credit_Card_Customer_DataQ-DatatoCloud_Full.

    2. In the Source Configuration area, configure the data source.

      Parameter

      Description

      Example

      Data Source

      The type of the source data source and the data source that has been added for that type.

      MySQL/dataq_dws_rds

      Data Table

      The source table in the data source.

      ys_yhkh (on-premises)

      Sync Mode

      The method for data synchronization. The default is Full.

      Full

      Custom Condition

      You can enter a custom SQL query condition to perform full data synchronization based on the condition.

      gz>10000

      Note

      Syncs all bank customer data for salaries greater than 10,000.

    3. In the Destination Configuration area, configure the destination data.

      Parameter

      Description

      Example

      Destination

      The type of the destination data source and the data source that has been added for that type.

      MaxCompute/dataq_odps_dev

      Data Table

      The table to which data is written in the data source.

      If the table already exists in the destination data source, click the Data Table drop-down list and select it. If the destination table does not exist, create it as follows:

      1. Click the Data Table drop-down list and select Create Destination Object.

      2. In the Create Table dialog box, the system automatically generates the table name, remarks, and fields based on the source data object that you configured in the previous step. Change the table name to `stg_base_yhkh_demo_di` and set Partition Information to Non-partitioned table.

      3. After you complete the configuration, click OK to return to the task configuration page.

      stg_base_yhkh_demo_df

      Write Rule

      Supports clearing or retaining existing data before writing new data.

      Clear existing data before writing

    4. In the Field Mapping area, Same Name Mapping is selected by default.

  7. After you complete the configuration, click the image.png icon in the upper-left corner of the Offline Data Synchronization Management page.

  8. On the Offline Data Synchronization management page, find the new full offline data sync task and click Publish in the Actions column.

Expected results

  1. On the Offline Data Synchronization management page, find the Credit_Card_Customer_DataQ-DatatoCloud_Full sync task that is in the Published state. In the Actions column, click Monitoring. You are redirected to the Offline Sync Instance page under Service Monitoring. The page shows that the task instance completed successfully.

  2. Go to the Data Query module and click Physical Table Query. Select the destination data source and table dataq_odps_dev/stg_base_yhkh_demo_df. In Data Preview, you can view the data with gz (salary) greater than CNY 10,000 that has been written to the stg_base_yhkh_demo_df table.