Skip to main content

Create Schema Comparison Task

Create a schema comparison task and specify the source, target, and object scope to compare.

Request URL: /openapi/v1/compareschema/create

Request Method: POST

Before You Call

  • sourceDsId and targetDsId can be obtained from data[].datasourceId in List Data Sources.
  • The objectConfig structure is the same as the objectConfig used by Create Data Comparison Task. Use databaseList, schemaList, tableList, and related fields to specify databases, schemas, tables, and mappings.
  • To create a scheduled schema comparison task, set taskType to PERIODIC and pass scheduleConfig.

Request Parameters

ParameterTypeRequiredDescriptionExample
taskNameStringYesSchema comparison task name.schema_compare_demo
sourceDsIdStringYesSource data source ID.ds-ct192k3jlj4f
targetDsIdStringYesTarget data source ID.ds-d37s953l33d3
objectConfigJSONYesObject scope configuration. The structure is the same as objectConfig in Create Data Comparison Task.See the example below
taskTypeStringNoScheduling type. ONETIME means one-time comparison, and PERIODIC means scheduled comparison. Default value: ONETIME.ONETIME
scheduleConfigObjectNoScheduled comparison configuration. Pass it only when taskType=PERIODIC.See the example below

scheduleConfig Fields

ParameterTypeRequiredDescriptionExample
scheduleTypeStringNoPass periodic for scheduled comparison.periodic
daysString[]NoDays to run the task. Valid values: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY.["MONDAY","TUESDAY"]
startTimeOfDayStringNoStart time on each scheduled day, in HH:mm format. Default value: 01:00.11:31
timezoneStringNoTime zone for the start time. Default value: +08:00_CST.+08:00_CST

Request Example

{
"taskName": "schema_compare_demo",
"sourceDsId": "ds-ct192k3jlj4f",
"targetDsId": "ds-d37s953l33d3",
"taskType": "ONETIME",
"objectConfig": {
"all": false,
"allDatabase": false,
"databaseList": [
{
"objectType": "database",
"databaseName": "9zdbtest2",
"targetDatabase": "9zdbtest3",
"all": false,
"tableList": [
{
"databaseName": "9zdbtest2",
"targetDatabase": "9zdbtest3",
"tableName": "sbtest1",
"targetTable": "sbtest1"
}
]
}
],
"migrateTrigger": false,
"migrateEvent": false
}
}

Scheduled Task scheduleConfig Example

{
"scheduleType": "periodic",
"days": [
"MONDAY",
"TUESDAY",
"WEDNESDAY",
"THURSDAY",
"FRIDAY",
"SATURDAY",
"SUNDAY"
],
"startTimeOfDay": "11:31",
"timezone": "+08:00_CST"
}

Response Parameters

ParameterTypeDescriptionExample
successBooleanWhether the request is successful.true
requestIdStringRequest ID, which can be used for troubleshooting and tracing.Fw5n8KVE-jpqkrAKnlppo9DXdknc3IUH
dataObjectCreation result. See the fields below.See the example below
messageStringError message returned when the request fails.taskName is required

data Fields

ParameterTypeDescriptionExample
taskIdStringNew schema comparison task ID.cc-th6j3fs58y

Successful Invocation Example

{
"success": true,
"requestId": "Fw5n8KVE-jpqkrAKnlppo9DXdknc3IUH",
"data": {
"taskId": "cc-th6j3fs58y"
}
}