Updated on 2024-10-25 GMT+08:00

Querying the Incremental DDL List

Function

This API is used to query the incremental DDL list by DDL status.

URI

GET /v5/{project_id}/jobs/{job_id}/ddl

Table 1 Path parameters

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.

job_id

Yes

String

Task ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Offset. The default value is 0, indicating that the records after this offset will be queried.

limit

No

Integer

Maximum number of records that can be returned. The default value is 10.

start_seq_no

No

Long

Start DDL No.

end_seq_no

No

Long

End DDL No.

status

No

Integer

DDL status. The value 0 indicates that no alarm is generated, and the value 1 indicates that an alarm is generated.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

MIME type of the request body. Use the default value application/json. For APIs used to upload objects or images, the value varies depending on the flow type.

X-Auth-Token

Yes

String

User token obtained from IAM. It is a response to the API for obtaining a user token. This API is the only one that does not require authentication. The token is the value of X-Subject-Token in the response header.

X-Language

No

String

Request language type.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

ddl_list

Array of DdlAlarmResp objects

DDL alarm information list.

count

Integer

Total number of records in the list, which is irrelevant to pagination.

Table 5 DdlAlarmResp

Parameter

Type

Description

seqno

Long

Unique sequence number of a record.

checkpoint

String

Source database position.

status

Integer

DDL alarm status. 0: No alarm is generated. 1: An alarm is generated.

ddl_timestamp

Long

DDL execution time on the source database.

ddl_text

String

DDL content.

exe_result

Boolean

DDL execution result. The value false indicates that the execution fails, and the value true indicates that the execution succeeds.

record_time

Long

Time when data is recorded.

clean_time

Long

Time when a DDL alarm is cleared.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Request

Querying the incremental DDL history list

https://{endpoint}/v5/5237e10fe9aa4ad5b16b6a5245248314/jobs/7f486edc-6abb-4621-892b-4805221jb2h4/ddl

Example Response

Status code: 200

OK

{
  "count" : 1,
  "ddl_list" : [ {
    "seqno" : 30,
    "checkpoint" : "mysql-bin.000006:431;200e3d00-4a57-11ef-8a76-fa163ef2208a:7;200e3d00-4a57-11ef-8a76-fa163ef2208a:1-7",
    "status" : 1,
    "ddl_timestamp" : 1721894317000,
    "ddl_text" : "/* sql from das */ALTER TABLE `test1`.`test1`\n\tADD COLUMN `gender` VARCHAR(32) NULL AFTER `name`",
    "exe_result" : true,
    "record_time" : 1721894318544,
    "clean_time" : 1721897321317
  } ]
}

Status code: 400

Bad Request

{
  "error_code" : "DRS.10000001",
  "error_msg" : "Failed."
}

Status Code

Status Code

Description

200

OK

400

Bad Request

Error Code

For details, see Error Code.