GenerateDISyncTaskConfigForCreating

Updated at:

Asynchronously generates the JSON configuration for a synchronization task.

Operation description

Call CreateDISyncTask directly to create a Data Integration batch synchronization task. For real-time and other synchronization tasks, first call GenerateDISyncTaskConfigForCreating, then call QueryDISyncTaskConfigProcessResult to obtain the asynchronously generated configuration. Pass that configuration to CreateDISyncTask to create the task. Real-time and other synchronization tasks can only be created using this asynchronous workflow.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

ProjectId

integer

Yes

The ID of the DataWorks workspace. You can log on to the DataWorks console and go to the Workspace Management page to obtain the workspace ID.

This parameter specifies the DataWorks workspace for the current API call.

10000

TaskType

string

Yes

The type of the Data Integration synchronization task to be created by using the asynchronous method. Valid values:

  • DI_REALTIME: real-time synchronization task

  • DI_SOLUTION: other types of synchronization tasks

Only the asynchronous method is supported for generating real-time synchronization tasks and other types of synchronization tasks.

Valid values:

  • DI_REALTIME :

    Real-time synchronization task.

  • DI_SOLUTION :

    Solution synchronization task.

  • DI_OFFLINE :

    Offline synchronization task.

DI_REALTIME

TaskParam

string

Yes

The script of the Data Integration synchronization task. The following synchronization task types are supported:

  • Synchronize data from MySQL to MaxCompute.

  • Synchronize data from MySQL to Kafka.

  • Synchronize data from MySQL to Hologres.

SelectedTables is used to select synchronization tables in multi-database mode, and Tables is used to select synchronization tables in single-database mode.

  • If the script contains the SelectedTables statement, the system uses the table information in the SelectedTables statement for synchronization.

  • If the script contains the Tables statement, the system uses the field information of Tables for synchronization.

The following example shows the script for synchronizing data from MySQL to MaxCompute:

{
  "type": "realtime",
  "version": "1.0",
  "setting": {
    "resourceGroup": "S_res_group_280749521950784_1623033752022",
    "taskType": "oneclick_to_odps"
  },
  "steps": [
    {
      "stepType": "mysql",
      "parameter": {
        "connection": [
          {
            "datasourceType": "mysql",
            "datasource": "mysql_pub1",
            "selectedTables": [
              {
                "dbName": "mysql_db",
                "schema": [
                  {
                    "tableInfos": [
                      {
                        "table": "molin_di_test_in_pk_v4"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      "name": "Reader",
      "category": "reader"
    },
    {
      "stepType": "odps",
      "parameter": {
        "datasource": "odps_source"
      },
      "name": "Writer",
      "category": "writer"
    }
  ]
}

The following example shows the script for synchronizing data from MySQL to Kafka:

{
  "type": "realtime",
  "version": "1.0",
  "setting": {
    "resourceGroup": "S_res_group_280749521950784_1623033752022",
    "taskType": "oneclick_to_kafka"
  },
  "steps": [
    {
      "stepType": "mysql",
      "parameter": {
        "connection": [
          {
            "datasourceType": "mysql",
            "datasource": "pkset_test",
            "selectedTables": [
              {
                "dbName": "mysql_db",
                "schema": [
                  {
                    "tableInfos": [
                      {
                        "table": "molin_di_test_in_pk_v4"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      "name": "Reader",
      "category": "reader"
    },
    {
      "stepType": "kafka",
      "parameter": {
        "datasource": "azn_kafka"
      },
      "name": "Writer",
      "category": "writer"
    }
  ]
}

The following example shows the script for synchronizing data from MySQL to Hologres:

{
  "type": "realtime",
  "version": "1.0",
  "setting": {
    "resourceGroup": "S_res_group_280749521950784_1623033752022",
    "taskType": "oneclick_to_holo"
  },
  "steps": [
    {
      "stepType": "mysql",
      "parameter": {
        "connection": [
          {
            "datasourceType": "mysql",
            "datasource": "mysql_pub",
            "selectedTables": [
              {
                "dbName": "mysql_db",
                "schema": [
                  {
                    "tableInfos": [
                      {
                        "table": "molin_di_test_in2_pk_v3"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      "name": "Reader",
      "category": "reader"
    },
    {
      "stepType": "holo",
      "parameter": {
        "datasource": "holo"
      },
      "name": "Writer",
      "category": "writer"
    }
  ]
}

{ "type": "realtime", "version": "1.0", "setting": { "resourceGroup": "S_res_group_280749521950784_1623033752022", "taskType": "oneclick_to_odps" }, "steps": [{ "stepType": "mysql", "parameter": { "connection": [ { "datasourceType": "mysql", "datasource": "mysql_pub1", "selectedTables": [ { "dbName": "mysql_db", "schema": [ { "tableInfos": [ { "table": "molin_di_test_in_pk_v4" }] } ] } ] } ] }, "name": "Reader", "category": "reader" }, { "stepType": "odps", "parameter": { "datasource": "odps_source" }, "name": "Writer", "category": "writer" } ] }

ClientToken

string

No

The idempotency token. This parameter prevents duplicate operations caused by multiple calls.

ABFUOEUOTRTRJKE

Response elements

Element

Type

Description

Example

object

The response structure.

Success

boolean

Indicates whether the request is successful. Valid values:

  • true: The request is successful.

  • false: The request fails.

true

RequestId

string

The request ID. You can use this ID to locate logs and troubleshoot issues.

0bc1411515937635973****

Data

object

The generation result of the asynchronous thread ID.

Status

string

The status of the asynchronous thread ID generation. Valid values:

  • success: The asynchronous thread ID is generated.

  • fail: The asynchronous thread ID fails to be generated. You can check the cause of the failure and resolve the issue.

true

ProcessId

integer

The asynchronous operation ID. Use it to call QueryDISyncTaskConfigProcessResult and obtain the generated configuration. Pass that configuration when you create the Data Integration synchronization task.

10

Message

string

The description of the cause for the failure to generate the asynchronous thread ID. If the asynchronous thread ID is generated, this parameter is left empty.

XXX is invalid.

Examples

Success response

JSON format

{
  "Success": true,
  "RequestId": "0bc1411515937635973****",
  "Data": {
    "Status": "true",
    "ProcessId": 10,
    "Message": "XXX is invalid."
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 Invalid.DI.Parameter The parameter is invalid. The parameter is invalid.
400 Invalid.DI.Parameter.File.Existed The file name already exists. The parameter is invalid. The file name already exists.
500 InternalError.DI.Parameter A DI internal error occurred. A Data Integration internal business error occurred.
403 Forbidden.DI.NoPrivilege No access. Access denied.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.