Full data synchronization
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
You have created a workspace group. For more information, see Create a workspace group.
You have added MaxCompute and ApsaraDB RDS for MySQL data sources to the workspace group. For more information, see Add a compute resource.
You have obtained the physical tables from the data source. For more information, see Obtain a physical table.
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
Log on to the Data Resource Platform console.
In the upper-left corner of the page, choose
> Collaboration.In the top menu bar, click the
icon and select the target workspace group.In the navigation pane on the left, click
> Offline Data Synchronization.On the Offline Data Synchronization page, click Add Task.
On the Offline Data Synchronization management page, configure the offline auto triggered task.
Fill in the basic information. Set Task Name to Credit_Card_Customer_DataQ-DatatoCloud_Full.
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
NoteSyncs all bank customer data for salaries greater than 10,000.
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:
Click the Data Table drop-down list and select Create Destination Object.
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.
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
In the Field Mapping area, Same Name Mapping is selected by default.
After you complete the configuration, click the
icon in the upper-left corner of the Offline Data Synchronization Management page.On the Offline Data Synchronization management page, find the new full offline data sync task and click Publish in the Actions column.
Expected results
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.
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.