跳到主要内容

查询数据对比表汇总

查询指定数据对比任务某次执行的表级对比结果,支持按库名、Schema 名称或表名关键字筛选。

请求地址:/openapi/v1/comparedata/result/tableSummary

请求方法:GET

调用前准备

请求参数

参数类型是否必填说明示例
taskIdString数据对比主任务 ID。cd-tg3isu1xgs
execIdInteger数据对比任务某次执行的子任务 ID。326816
schemaNameString数据库名或 Schema 名称过滤条件。一个任务对比多个库或 Schema 时,可通过该参数缩小查询范围。a2a
tableNameLikeString表名模糊搜索条件。对于 PostgreSQL 或 SQL Server 等数据源,取值通常可使用 public.table_namedbo.table_name 格式。popup
pageSizeInteger每页记录数,默认为 30,最大为 10030
pageNumberInteger当前页码,默认从 1 开始。1

返回参数

参数类型说明示例
successBoolean请求是否成功。true
requestIdString请求 ID,可用于问题排查和链路追踪。Ta7q9BNC-jppqeSZnkkrr3TWdlmc7PAK
dataObject表级对比汇总对象。见下方字段说明

data 字段说明

参数类型说明示例
taskIdString数据对比主任务 ID。cd-tg3isu1xgs
execIdInteger本次查询的数据对比执行 ID。326816
totalTableCountInteger满足过滤条件的表总数。1
diffTableCountInteger存在不一致数据的表总数。1
pageNumberInteger当前返回的页码。1
pageSizeInteger每页记录数。30
tableSummariesArray表级汇总信息列表。见下方字段说明

tableSummaries 字段说明

参数类型说明示例
progressIdInteger单个表对比结果的唯一标识。查询不一致详情或订正 SQL 时需要传入该值。2934527
schemaNameString源端数据库名或 Schema 名称。a2a
tableNameString源端表名。对于 database/schema/table 层级的数据源,可包含 Schema 和表名。t_popup_control_src
targetSchemaNameString目标端数据库名或 Schema 名称。a2a
targetTableNameString目标端表名。t_popup_control_target
statusString表对比状态。取值包括:UnstartedComparingFailedSkippedSuccessSuccess
sourceTotalRowsLong源端表记录数。5
targetTotalRowsLong目标端表记录数。6
sourceOnlyCountLong仅源端存在的记录数。3
targetOnlyCountLong仅目标端存在的记录数。4
mismatchCountLong主键相同但字段值不同的记录数。1
errorMessageString表状态为失败或跳过时返回的异常原因。""
primaryKeyColumnsString主键或唯一键字段名列表。control_id
columnsMappingString源端和目标端字段映射关系,通常为 JSON 字符串。{"control_id":"origin_id"}

请求示例

{
"taskId": "cd-tg3isu1xgs",
"execId": 326816,
"pageNumber": 1,
"pageSize": 30
}

调用成功示例

{
"success": true,
"requestId": "Ta7q9BNC-jppqeSZnkkrr3TWdlmc7PAK",
"data": {
"taskId": "cd-tg3isu1xgs",
"execId": 326816,
"totalTableCount": 1,
"diffTableCount": 1,
"pageNumber": 1,
"pageSize": 30,
"tableSummaries": [
{
"progressId": 2934527,
"schemaName": "a2a",
"tableName": "t_popup_control_src",
"targetSchemaName": "a2a",
"targetTableName": "t_popup_control_target",
"status": "Success",
"sourceTotalRows": 5,
"targetTotalRows": 6,
"sourceOnlyCount": 3,
"targetOnlyCount": 4,
"mismatchCount": 1,
"primaryKeyColumns": "control_id",
"columnsMapping": "{\"control_id\":\"origin_id\",\"popup_name\":\"popup_name\",\"app_id\":\"app_id\"}"
}
]
}
}