All Products
Search
Document Center

MaxCompute:Migrate data from MaxCompute to Tablestore

Last Updated:Feb 27, 2026

This topic describes how to migrate data from MaxCompute to Tablestore by using the data integration feature of DataWorks.

Prerequisites

Before you begin, make sure that you have:

Procedure

Step 1: Create a source table in MaxCompute

  1. Log on to the DataWorks console and select a region in the upper-left corner.

  2. In the left navigation pane, click Workspace.

  3. On the Workspaces page, find the target workspace. In the Actions column, choose Shortcuts > Data Development.

  4. On the Data Studio page, create an ODPS SQL node and run the following statement to create a table named transs:

       CREATE TABLE transs
       (name    STRING,
       id    STRING,
       gender    STRING);

Step 2: Import data into the source table

  1. Save the following sample data to a CSV file on your computer:

       qwe,145,F
       asd,256,F
       xzc,345,M
       rgth,234,F
       ert,456,F
       dfg,12,M
       tyj,4,M
       bfg,245,M
       nrtjeryj,15,F
       rwh,2344,M
       trh,387,F
       srjeyj,67,M
       saerh,567,M
  2. In the left navigation pane, choose Data Integration > Data Upload and Download.

  3. In the left navigation pane, click the upload icon image and then click Upload Data.

  4. Follow the on-screen instructions to upload the CSV file to the transs table.

Step 3: Create a destination table in Tablestore

  1. Log on to the Tablestore console and create an instance.

  2. Create a data table named trans with the following primary keys: For more information, see Create a data table.

    Primary keyType
    nameSTRING
    idINTEGER

Step 4: Add data sources in DataWorks

Add a MaxCompute data source

  1. Log on to the DataWorks console and select a region in the upper-left corner.

  2. In the left navigation pane, click Workspace.

  3. On the Workspaces page, click the name of the target workspace.

  4. On the Workspace Details page, click Data Sources in the left navigation pane.

  5. On the Data Source tab, click Add Data Source and select MaxCompute.

  6. On the Add MaxCompute Data Source page, configure the Basic Information. For more information, see Configure a MaxCompute data source.

Add a Tablestore data source

Add a Tablestore data source in DataWorks. For more information, see Configure a Tablestore data source.

Step 5: Create and run a batch synchronization job

  1. Log on to the DataWorks console and select a region in the upper-left corner.

  2. In the left navigation pane, choose Data Development and O&M > Data Development.

  3. In the Select Workspace section, click Go to Data Studio.

  4. In the left pane of Data Studio, click the image icon and select Create Node > Data Integration > Batch Synchronization.

  5. In the Create Node dialog, configure the following required fields: Click Confirm.

    FieldValue
    Source TypeMaxCompute(ODPS)
    Destination TypeTablestore
    NameEnter a name for the node
  6. On the node configuration page, configure the following parameters: Keep the default values for all other parameters.

    ParameterValue
    Data Source - SourceThe MaxCompute data source that you added
    Data Source - DestinationThe Tablestore data source that you added
    Source - TableThe MaxCompute table (transs)
    Destination - TableThe Tablestore table (trans)
    Runtime ResourceThe resource group for Data Integration
  7. Click the Run icon in the toolbar to run the batch synchronization job.

Script mode (alternative)

You can also click the Switch to code icon above the configuration section to switch to the code editor. The following JSON shows an example configuration:

{
    "type": "job",
    "steps": [
        {
            "stepType": "odps",
            "parameter": {
                "partition": [],
                "datasource": "odps_first",
                "column": [
                    "name",
                    "id",
                    "gender"
                ],
                "table": "transs"
            },
            "name": "Reader",
            "category": "reader"
        },
        {
            "stepType": "ots",
            "parameter": {
                "datasource": "transs",
                "column": [
                    {
                        "name": "gender",
                        "type": "STRING"
                    }
                ],
                "writeMode": "UpdateRow",
                "table": "trans",
                "primaryKey": [
                    {
                        "name": "name",
                        "type": "STRING"
                    },
                    {
                        "name": "id",
                        "type": "INT"
                    }
                ]
            },
            "name": "Writer",
            "category": "writer"
        }
    ],
    "version": "2.0",
    "order": {
        "hops": [
            {
                "from": "Reader",
                "to": "Writer"
            }
        ]
    },
    "setting": {
        "errorLimit": {
            "record": "0"
        },
        "speed": {
            "throttle": false,
            "concurrent": 1
        }
    }
}

The following table describes the script parameters:

ParameterDescription
stepTypeThe plugin type. odps for MaxCompute (ODPS) Reader. ots for Tablestore (OTS) Writer.
datasourceThe name of the data source registered in DataWorks.
columnThe columns to read or write. For the Reader, specify the column names. For the Writer, specify only the non-primary-key attribute columns with name and data type.
tableThe table name. transs for the source table. trans for the destination table.
primaryKeyThe primary key columns of the Tablestore table, with name and type.
writeModeThe write mode. UpdateRow updates an existing row or inserts a new row.
errorLimit.recordThe maximum number of error records allowed. "0" means no errors are tolerated.
speed.concurrentThe number of concurrent channels for the sync job.
speed.throttleWhether to enable bandwidth throttling. false disables throttling.

Step 6: Verify the migrated data

After the sync job runs, verify that the data is migrated to Tablestore.

  1. Log on to the Tablestore console and select a region in the upper-left corner.

  2. In the left navigation pane, click All Instances.

  3. On the All Instances page, click the instance name to go to the Instance Management page.

  4. Click the Instance Details tab.

  5. In the Tables section, click the name of the trans data table.

  6. On the data table management page, click the Query Data tab to view the migrated data.