Skip to main content

Create Data Comparison Task

Creates a data comparison task, including the source and target data sources and the scope of databases and tables to compare.

Request URL: /openapi/v1/comparedata/create

Request Method: POST

Request Parameters

ParameterTypeRequiredDescriptionExample
nameStringYesTask name.codex-compare-1775716827866
sourceDsIdStringYesSource data source ID. You can call Get Data Source List to query it.ds-d8k4ch8yj9o0
targetDsIdStringYesTarget data source ID. You can call Get Data Source List to query it.ds-d8k49pw2xbcf
taskModeStringYesComparison type. The documented value in the current source is FULL, which means full comparison.FULL
objectConfigObjectYesComparison object configuration. See objectConfig Fields.{
"all": false,
"databaseList": []
}

objectConfig Fields

ParameterTypeRequiredDescriptionExample
allBooleanYesWhether to select all objects in the instance.false
databaseListArrayNoList of databases and objects to compare. Used when all=false. See databaseList Fields.[{...}]

databaseList Fields

ParameterTypeRequiredDescriptionExample
databaseNameStringYesSource database name.sample_employees_337
targetDatabaseStringYesTarget database name.sample_employees_337
allBooleanYesWhether to select all tables in the database.true
tableListArrayNoList of tables to compare. Used when all=false. See tableList Fields.[{...}]

tableList Fields

ParameterTypeRequiredDescriptionExample
tableNameStringYesSource table name.departments
targetTableStringYesTarget table name.departments

Request Example

{
"name": "codex-compare-1775716827866",
"sourceDsId": "ds-d8k4ch8yj9o0",
"targetDsId": "ds-d8k49pw2xbcf",
"taskMode": "FULL",
"objectConfig": {
"all": false,
"allDatabase": false,
"databaseList": [
{
"all": true,
"databaseName": "sample_employees_337",
"ddlTriggerList": [],
"eventList": [],
"functionList": [],
"objectFullName": "sample_employees_337",
"objectName": "sample_employees_337",
"objectType": "DATABASE",
"otherStoredObjectList": [],
"procedureList": [],
"tableList": [
{
"objectFullName": "departments",
"objectName": "departments",
"objectType": "TABLE",
"tableName": "departments",
"targetDatabase": "sample_employees_337",
"targetName": "departments",
"targetTable": "departments"
},
{
"objectFullName": "dept_emp",
"objectName": "dept_emp",
"objectType": "TABLE",
"tableName": "dept_emp",
"targetDatabase": "sample_employees_337",
"targetName": "dept_emp",
"targetTable": "dept_emp"
},
{
"objectFullName": "dept_manager",
"objectName": "dept_manager",
"objectType": "TABLE",
"tableName": "dept_manager",
"targetDatabase": "sample_employees_337",
"targetName": "dept_manager",
"targetTable": "dept_manager"
},
{
"objectFullName": "employees",
"objectName": "employees",
"objectType": "TABLE",
"tableName": "employees",
"targetDatabase": "sample_employees_337",
"targetName": "employees",
"targetTable": "employees"
},
{
"objectFullName": "salaries",
"objectName": "salaries",
"objectType": "TABLE",
"tableName": "salaries",
"targetDatabase": "sample_employees_337",
"targetName": "salaries",
"targetTable": "salaries"
}
],
"targetDatabase": "sample_employees_337",
"targetName": "sample_employees_337",
"viewList": []
}
],
"migrateEvent": true,
"migrateTrigger": true
}
}

Response Parameters

ParameterTypeDescriptionExample
successBooleanWhether the request succeeds.true
requestIdStringRequest ID.Cv8i6FVH-HNNLmSTnNHMj2CDdOGs6YLG
dataStringData comparison task ID.cd-td7rupk2ps

Successful Invocation Example

{
"success": true,
"requestId": "Cv8i6FVH-HNNLmSTnNHMj2CDdOGs6YLG",
"data": "cd-td7rupk2ps"
}