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
sourceDsIdandtargetDsIdcan be obtained fromdata[].datasourceIdin List Data Sources.- The
objectConfigstructure is the same as theobjectConfigused by Create Data Comparison Task. UsedatabaseList,schemaList,tableList, and related fields to specify databases, schemas, tables, and mappings. - To create a scheduled schema comparison task, set
taskTypetoPERIODICand passscheduleConfig.
Request Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| taskName | String | Yes | Schema comparison task name. | schema_compare_demo |
| sourceDsId | String | Yes | Source data source ID. | ds-ct192k3jlj4f |
| targetDsId | String | Yes | Target data source ID. | ds-d37s953l33d3 |
| objectConfig | JSON | Yes | Object scope configuration. The structure is the same as objectConfig in Create Data Comparison Task. | See the example below |
| taskType | String | No | Scheduling type. ONETIME means one-time comparison, and PERIODIC means scheduled comparison. Default value: ONETIME. | ONETIME |
| scheduleConfig | Object | No | Scheduled comparison configuration. Pass it only when taskType=PERIODIC. | See the example below |
scheduleConfig Fields
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| scheduleType | String | No | Pass periodic for scheduled comparison. | periodic |
| days | String[] | No | Days to run the task. Valid values: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY. | ["MONDAY","TUESDAY"] |
| startTimeOfDay | String | No | Start time on each scheduled day, in HH:mm format. Default value: 01:00. | 11:31 |
| timezone | String | No | Time 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
| Parameter | Type | Description | Example |
|---|---|---|---|
| success | Boolean | Whether the request is successful. | true |
| requestId | String | Request ID, which can be used for troubleshooting and tracing. | Fw5n8KVE-jpqkrAKnlppo9DXdknc3IUH |
| data | Object | Creation result. See the fields below. | See the example below |
| message | String | Error message returned when the request fails. | taskName is required |
data Fields
| Parameter | Type | Description | Example |
|---|---|---|---|
| taskId | String | New schema comparison task ID. | cc-th6j3fs58y |
Successful Invocation Example
{
"success": true,
"requestId": "Fw5n8KVE-jpqkrAKnlppo9DXdknc3IUH",
"data": {
"taskId": "cc-th6j3fs58y"
}
}