Querying Comparison Results
Function
This API is used to query the comparion result.
Constraints
This API can be called only after the API in Creating a Comparison Task is successfully called.
URI
POST /v3/{project_id}/jobs/query-compare-result
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID of a tenant in a region. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
Content-Type |
Yes |
String |
The content type. The default value is application/json. |
|
X-Auth-Token |
Yes |
String |
User token obtained from IAM. |
|
X-Language |
No |
String |
Request language type Default value: en-us Values:
|
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
job_id |
Yes |
String |
Task ID |
|
object_level_compare_id |
No |
String |
ID of the object-level comparison task that requests the query result. |
|
line_compare_id |
No |
String |
ID of the row comparison task that requests the query result. |
|
content_compare_id |
No |
String |
ID of the value comparison task that requests the query result. |
|
current_page |
Yes |
Integer |
Current page number for pagination query, which is valid for the query result of comparison tasks. |
|
per_page |
Yes |
Integer |
Number of records on each page. This parameter is valid only for query results of comparison tasks. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
job_id |
String |
Task ID |
|
object_level_compare_results |
Object |
Object-level comparison result. For details, see Table 5. |
|
line_compare_results |
Object |
Row comparison result. For details, see Table 8. |
|
content_compare_results |
Object |
Value comparison result. For details, see Table 12. |
|
compare_task_list_results |
Object |
List of comparison tasks. For details, see Table 18. |
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error message. |
|
Parameter |
Type |
Description |
|---|---|---|
|
compare_task_id |
String |
ID of an object-level comparison task. |
|
object_compare_overview |
Array of objects |
Overview of object comparison results. For details, see Table 6. |
|
object_compare_details |
Map<String,Array<ObjectCompareResultDetails>> |
Object comparison result details. The key value is the object type in the object comparison result overview. For details, see Table 7. |
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error message. |
|
Parameter |
Type |
Description |
|---|---|---|
|
object_type |
String |
Object type. Values:
|
|
object_compare_result |
String |
Comparison result. Values:
|
|
target_count |
Integer |
Number of objects of this type in the destination database. |
|
source_count |
Integer |
Number of objects of this type in the source database. |
|
diff_count |
Integer |
Number of differences between the source and destination databases. |
|
Parameter |
Type |
Description |
|---|---|---|
|
source_db_name |
String |
Source database name. |
|
target_db_name |
String |
Destination database name. |
|
source_db_value |
String |
Value in the source database. |
|
target_db_value |
String |
Value in the destination database. |
|
error_message |
String |
Error message. |
|
Parameter |
Type |
Description |
|---|---|---|
|
compare_task_id |
String |
ID of a row comparison task. |
|
line_compare_overview |
Array of objects |
Row comparison result overview. For details, see Table 9. |
|
line_compare_overview_count |
Integer |
Row comparison result overview. |
|
line_compare_details |
Array of objects |
Row comparison result details. For details, see Table 10. |
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error message. |
|
Parameter |
Type |
Description |
|---|---|---|
|
source_db_name |
String |
Source database name. |
|
target_db_name |
String |
Destination database name. |
|
line_compare_result |
String |
Comparison result. Values:
|
|
Parameter |
Type |
Description |
|---|---|---|
|
source_db_name |
String |
Source database name. |
|
line_compare_detail |
Array of objects |
Row comparison details of the tables in the database. For details, see Table 11. |
|
line_compare_detail_count |
Integer |
Total number of row comparison results in the database. |
|
Parameter |
Type |
Description |
|---|---|---|
|
source_table_name |
String |
Table name of the source database. |
|
target_table_name |
String |
Table name of the destination database. |
|
source_row_num |
Integer |
Number of table rows in the source database. |
|
target_row_num |
Integer |
Number of table rows in the destination database. |
|
diff_row_num |
Integer |
Difference between the tables in the source and destination databases. |
|
line_compare_result |
String |
Comparison result. Values:
|
|
message |
String |
Additional information. |
|
Parameter |
Type |
Description |
|---|---|---|
|
compare_task_id |
String |
ID of a value comparison task. |
|
content_compare_overview |
Array of objects |
Content comparison result overview. For details, see Table 13. |
|
content_compare_overview_count |
Integer |
Total number of value comparison results. |
|
content_compare_details |
Array of objects |
Value comparison result details. For details, see Table 14. |
|
content_compare_diffs |
Array of objects |
The value comparison results are different. For details, see Table 16. |
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error message. |
|
Parameter |
Type |
Description |
|---|---|---|
|
source_db_name |
String |
Source database name. |
|
target_db_name |
String |
Destination database name. |
|
content_compare_result |
String |
Comparison result. Values:
|
|
Parameter |
Type |
Description |
|---|---|---|
|
source_db_name |
String |
Source database name. |
|
content_compare_detail |
Array of objects |
Value comparison details of the tables in the database. For details, see Table 15. |
|
content_compare_detail_count |
Integer |
Total number of value comparison results. |
|
content_uncompare_detail |
Array of objects |
Value comparison details of tables in the database (tables that cannot be compared). For details, see Table 15. |
|
content_uncompare_detail_count |
Integer |
Total number of value comparison results (tables that cannot be compared). |
|
Parameter |
Type |
Description |
|---|---|---|
|
source_db_name |
String |
Source database name. |
|
target_db_name |
String |
Destination database name. |
|
source_table_name |
String |
Source database name. |
|
target_table_name |
String |
Name of a table in the destination database. |
|
source_row_num |
Integer |
Number of rows in the table of the source database. |
|
target_row_num |
Integer |
Number of rows in the table of the destination database. |
|
diff_row_num |
Integer |
Difference between the tables in the source and destination databases. |
|
line_compare_result |
String |
Row comparison result. Values:
|
|
content_compare_result |
String |
Value comparison result. Values:
|
|
message |
String |
Provides additional information. |
|
Parameter |
Type |
Description |
|---|---|---|
|
source_db_name |
String |
Source database name. |
|
source_table_name |
String |
Table name of the source database. |
|
content_compare_diff |
Array of objects |
The value comparison results are different. For details, see Table 17. |
|
content_compare_diff_count |
Integer |
Total number of differences in the value comparison result. |
|
Parameter |
Type |
Description |
|---|---|---|
|
target_select_sql |
String |
Query the SQL statements of the destination database. |
|
source_select_sql |
String |
Query the SQL statements of the source database. |
|
source_key_value |
Array of strings |
Key value list of the source database. |
|
target_key_value |
Array of strings |
Key value list of the destination database. |
|
Parameter |
Type |
Description |
|---|---|---|
|
compare_task_list |
Array of objects |
List of comparison tasks. For details, see Table 19. |
|
compare_task_list_count |
Integer |
Total number of comparison tasks. |
|
error_msg |
String |
Error message. |
|
error_code |
String |
Error code. |
|
Parameter |
Type |
Description |
|---|---|---|
|
compare_task_id |
String |
ID of a comparison task. |
|
compare_type |
String |
Type of a comparison task. |
|
compare_task_status |
String |
Status of a comparison task. Values:
|
|
create_time |
String |
Comparison start time |
|
end_time |
String |
Comparison end time |
Example Request
Request for querying the comparison result:
https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/query-compare-result
{
"job_id" : "94800607-3cd8-4f7d-a340-63a10f8jb502",
"object_level_compare_id" : "dc1683d9-bdf2-4be9-967f-6ef0953369bc",
"line_compare_id" : "d45d569d-0a80-4cef-a412-da2a3bcdc9b7",
"content_compare_id" : "79e206e6-13eb-4556-8cd5-c994c9cbd4e6",
"current_page" : 1,
"per_page" : 2
}
Example Response
Status code: 200
OK
{
"job_id" : "c6e65e6a-de99-4112-9697-7c1923ajb201",
"object_level_compare_results" : {
"compare_task_id" : "dc1683d9-bdf2-4be9-967f-6ef0953369bc",
"object_compare_overview" : [ {
"object_type" : "DB",
"object_compare_result" : "CONSISTENT",
"source_count" : 1,
"target_count" : 1,
"diff_count" : 0
}, {
"object_type" : "INDEX",
"object_compare_result" : "CONSISTENT",
"source_count" : 12,
"target_count" : 12,
"diff_count" : 0
}, {
"object_type" : "TABLE",
"object_compare_result" : "CONSISTENT",
"source_count" : 6,
"target_count" : 6,
"diff_count" : 0
} ],
"object_compare_details" : {
"TABLE" : [ {
"source_db_name" : "may_5",
"target_db_name" : "may_5",
"source_db_value" : "add_table_name_0",
"target_db_value" : "add_table_name_0"
}, {
"source_db_name" : "may_5",
"target_db_name" : "may_5",
"source_db_value" : "table_name_3",
"target_db_value" : "table_name_3"
} ],
"INDEX" : [ {
"source_db_name" : "may_5",
"target_db_name" : "may_5",
"source_db_value" : "`add_table_name_0`.`PRIMARY`",
"target_db_value" : "`add_table_name_0`.`PRIMARY`"
}, {
"source_db_name" : "may_5",
"target_db_name" : "may_5",
"source_db_value" : "`add_table_name_0`.`bak0`",
"target_db_value" : "`add_table_name_0`.`bak0`"
} ],
"DB" : [ {
"source_db_name" : "may_5",
"target_db_name" : "may_5",
"source_db_value" : "may_5",
"target_db_value" : "may_5"
} ]
}
},
"line_compare_results" : {
"compare_task_id" : "d45d569d-0a80-4cef-a412-da2a3bcdc9b7",
"line_compare_overview" : [ {
"source_db_name" : "may_5",
"target_db_name" : "may_5",
"line_compare_result" : "INCONSISTENT"
} ],
"line_compare_overview_count" : 1,
"line_compare_details" : [ {
"source_db_name" : "may_5",
"line_compare_detail" : [ {
"source_table_name" : "table_name_0",
"source_row_num" : 0,
"target_table_name" : "table_name_0",
"target_row_num" : 1,
"diff_row_num" : 1,
"line_compare_result" : "INCONSISTENT"
}, {
"source_table_name" : "table_name_1",
"source_row_num" : 0,
"target_table_name" : "table_name_1",
"target_row_num" : 0,
"diff_row_num" : 0,
"line_compare_result" : "CONSISTENT"
} ],
"line_compare_detail_count" : 2
} ]
},
"content_compare_results" : {
"compare_task_id" : "79e206e6-13eb-4556-8cd5-c994c9cbd4e6",
"content_compare_overview" : [ {
"source_db_name" : "may_5",
"target_db_name" : "may_5",
"content_compare_result" : "INCONSISTENT"
} ],
"content_compare_overview_count" : 1,
"content_compare_details" : [ {
"source_db_name" : "may_5",
"content_compare_detail" : [ {
"source_db_name" : "may_5",
"target_db_name" : "may_5",
"source_table_name" : "table_name_0",
"target_table_name" : "table_name_0",
"source_row_num" : 0,
"target_row_num" : 1,
"diff_row_num" : 1,
"line_compare_result" : "INCONSISTENT",
"content_compare_result" : "INCONSISTENT"
}, {
"source_db_name" : "may_5",
"target_db_name" : "may_5",
"source_table_name" : "table_name_1",
"target_table_name" : "table_name_1",
"source_row_num" : 0,
"target_row_num" : 0,
"diff_row_num" : 0,
"line_compare_result" : "CONSISTENT",
"content_compare_result" : "CONSISTENT"
} ],
"content_compare_detail_count" : 2,
"content_uncompare_detail" : [ ],
"content_uncompare_detail_count" : 0
} ],
"content_compare_diffs" : [ {
"source_db_name" : "may_5",
"source_table_name" : "table_name_0",
"content_compare_diff" : [ {
"target_key_value" : [ "5" ],
"target_select_sql" : "select * from may_5.table_name_0 where id = 5"
} ],
"content_compare_diff_count" : 1
} ]
},
"compare_task_list_results" : {
"compare_task_list_count" : 8,
"compare_task_list" : [ {
"compare_task_id" : "08cad1f8-9de2-42fa-b8ce-6c36daf730f6",
"compare_type" : "contents",
"compare_task_status" : "SUCCESSFUL",
"create_time" : "1607766111833",
"end_time" : "1607766310812"
}, {
"compare_task_id" : "dc1683d9-bdf2-4be9-967f-6ef0953369bc",
"compare_type" : "object_comparison",
"compare_task_status" : "SUCCESSFUL",
"create_time" : "1607766110535",
"end_time" : "1607766127373"
} ]
}
}
Status Code
|
Status Code |
Description |
|---|---|
|
200 |
OK |
|
400 |
Bad Request |
Error Code
For details, see Error Code.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.