Batch Data Processing
Function
- This API is used to validate and generate batch data processing rules for MySQL to MySQL synchronization tasks.
- Learn how to authorize and authenticate this API before using it.
URI
- URI format
PATH:/v3/{project_id}/jobs/batch-transformation
Method: POST
- Parameter description
Table 1 Parameter description Name
Mandatory
Description
project_id
Yes
Specifies the project ID of a tenant in a region. For details, see Obtaining a Project ID.
- Header description
Table 2 Header description Name
Mandatory
Description
X-Auth-Token
Yes
Specifies the user token obtained from IAM. For details, see Authentication.
X-Language
Yes
Specifies the request language type. The value is case-insensitive, such as en-us.
Content-Type
Yes
Specifies the content type. The value is application/json.
- Request example
/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-transformation
Request
- Parameter description
Table 3 Parameter description Name
Mandatory
Type
Description
jobs
Yes
List<CheckDataTransformationReqV3>
Specifies the data processing request list.
For details, see Table 4.
Table 4 CheckDataTransformationReqV3 field description Name
Mandatory
Type
Description
job_id
Yes
String
Specifies the task ID, which must be unique.
object_info
Yes
DatabaseObjectVOV3
Specifies the object information. The value is empty when a configuration rule is generated.
For details, see Table 5.
transformation_info
Yes
TransformationInfoV3
Specifies the processing information.
For details, see Table 6.
config_transformation
No
ConfigTransformationVoV3
Specifies the configuration information. This parameter is mandatory for generating configuration rules.
For details, see Table 7.
Table 5 DatabaseObjectVOV3 field description Name
Mandatory
Type
Description
id
Yes
String
Specifies the database object and database table name, for example, hec-*-*-drs_test1.
select
Yes
String
Specifies whether to select advanced configuration. The value is true.
Table 6 TransformationInfoV3 field description Name
Mandatory
Type
Description
transformation_type
Yes
String
The processing rule value is contentConditionalFilter. The configuration rule value is configConditionalFilter.
value
Yes
String
Specifies the filter criteria. The processing rule value is a SQL conditional statement, and the configuration rule value is config. The value contains a maximum of 256 characters.
Table 7 ConfigTransformationVoV3 field description Name
Mandatory
Type
Description
db_table_name
Yes
String
Specifies the database name and table name.
db_name
Yes
String
Specifies the database name. The value contains a maximum of 256 characters.
table_name
Yes
String
Specifies the table name. The value contains a maximum of 256 characters.
col_names
Yes
String
Specifies the column name. The value contains a maximum of 256 characters.
prim_key_or_index
Yes
String
Specifies the primary key or unique index The value contains a maximum of 256 characters.
indexs
Yes
String
Specifies the index required for query is optimized. The value contains a maximum of 256 characters.
values
Yes
String
Specifies the filter criteria. The value contains a maximum of 256 characters.
- Request example
Step 1: Generate processing rules.
{ "jobs": [ { "job_id": "a3d5f4a8-dc97-4581-8071-e4977309jb21", "object_info": [ { "id": "hec-*-*-drs-test1", "select": "true" } ], "transformation_info": { "transformation_type": "contentConditionalFilter", "value": "age in (select age from hec.drs_test2 where update_time > '2020-06-10')" } }, { "job_id": "76d19cc1-a008-453d-a362-9fd37994jb21", "object_info": [ { "id": "hec-*-*-drs-test2", "select": "true" } ], "transformation_info": { "transformation_type": "contentConditionalFilter", "value": "age in (select age from hec.drs_test2 where update_time > '2020-06-10')" } } ] }Step 2: Generate configuration rules (which corresponds to the filtering operation on the console page).
{ "jobs": [ { "job_id": "a3d5f4a8-dc97-4581-8071-e4977309jb21", "object_info": [], "transformation_info": { "transformation_type": "configConditionalFilter", "value": "config" }, "config_transformation": { "col_names": "id,name,age,update_time", "db_name": "hec", "db_table_name": "hec.drs_test2", "indexs": "age,update_time", "prim_key_or_index": "id", "table_name": "drs_test2", "values": "update_time > '2020-06-10'" } }, { "job_id": "76d19cc1-a008-453d-a362-9fd37994jb21", "object_info": [], "transformation_info": { "transformation_type": "configConditionalFilter", "value": "config" }, "config_transformation": { "col_names": "id,name,age,update_time", "db_name": "hec", "db_table_name": "hec.drs_test1", "indexs": "age,update_time", "prim_key_or_index": "id", "table_name": "drs_test1", "values": "update_time > '2020-06-10'" } } ] }
To enable the filtering function when calling this API, you need to follow the steps in the preceding request example.
Normal Response
- Parameter description
Table 8 Parameter description Name
Type
Description
results
List<DataTransformationResp>
Indicates the response body for batch data processing.
For details, see Table 9.
count
Integer
Indicates the total number of records.
Table 9 DataTransformationResp field description Name
Type
Description
id
String
Indicates the task ID.
status
String
Indicates the data processing response status.
The value can be success or failed.
error_code
String
Indicates the task error code.
error_msg
String
Indicates the task error message.
- Response example
{ "jobs": [ { "id": "0eb704d0-5a1c-4cbd-b675-91152f06jb11", "status": "success" }, { "id": "76d19cc1-a008-453d-a362-9fd37994jb21", "status": "success" } ], "count": 2 }
- Response example
Abnormal Response
For details, see Abnormal Request Results.
Last Article: Querying Task Details in Batches
Next Article: Querying the Full Task Progress and Incremental Task Delay
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.