Help Center/ Data Replication Service/ API Reference/ APIs V5.0/ Workload Replay/ Exporting the SQL Report File of a Workload Replay Task
Updated on 2026-09-07 GMT+08:00

Exporting the SQL Report File of a Workload Replay Task

Function

This API is used to export the SQL report file of a workload replay task.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, no identity policy-based permissions are required for calling this API.

URI

POST /v5/{project_id}/jobs/{job_id}/export-replay-sql

Table 1 URI 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.

For details about how to obtain the task ID, see Obtaining a Task ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

No

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. After a request is processed, the value of X-Subject-Token in the header is the token value.

X-Language

No

String

Request language type

Enumerated values:

  • en-us

  • zh-cn

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

file_type

Yes

String

Type of the SQL file to export. The value can be:

  • abnormal_sql: abnormal SQL statement list

  • abnormal_sql_detail: abnormal SQL statement details

  • slow_sql: slow SQL statement list

  • slow_sql_detail: slow SQL statement details

field_names

No

Array of strings

Field names to export. This parameter is mandatory when file_type is set to abnormal_sql_detail or slow_sql_detail. If multiple field names are to be exported, they will be separated with commas (,).

The value can be:

id: auto-increment ID

gmtCreate: creation time

gmtModified: modification time

shardId: shard ID

startTimestamp: timestamp when the SQL statement in the source database starts to be executed

executeTimePartition: replay time partition

schemaName: schema name

queryType: SQL type

sqlStatement: SQL content

sqlTemplate: SQL template

errorInfo: exception information

targetType: target database type

start_time

No

String

Start time, in timestamp format.

end_time

No

String

End time, in timestamp format.

Response Parameters

Status code: 202

ACCEPTED

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Request

This API is used to export the abnormal SQL list report file of a workload replay task.

https://{endpoint}/v5/246765b9f59445c3919fce121ea801f4/jobs/70e22c43-79e0-426a-8c97-0054efdjb60a/export-replay-sql

{
  "file_type" : "abnormal_sql"
}

Example Response

Status code: 202

ACCEPTED

{ }

Status code: 400

BAD REQUEST

{
  "error_code" : "DRS.10000023",
  "error_msg" : "program exception"
}

Status Codes

Status Code

Description

202

ACCEPTED

400

BAD REQUEST

For other statuses, see Status Code.

Error Code

For details, see Error Code.