Help Center/ Data Admin Service/ API Reference/ APIs/ Intelligent O&M/ Creating a Task for Exporting All SQL Statements
Updated on 2026-08-25 GMT+08:00

Creating a Task for Exporting All SQL Statements

Function

This API is used to create a task for exporting all SQL statements.

Authorization Information

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

  • If you are using role/policy-based authorization, see the required permissions in Permissions Policies and Supported Actions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    das:clouddba:fullSqlExport

    list

    Instance

    -

    -

    -

URI

POST /v3/{project_id}/fullsql/export

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region.

To obtain this value, see Obtaining a Project ID.

Constraints

N/A

Range

The value can contain 32 characters. Only letters and digits are supported.

Default Value

N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

start_at

Yes

Long

Definition

Start time in the Unix timestamp format, in milliseconds

Constraints

N/A

Range

[0, 2^31 – 1]. The actual value depends on the query result.

Default Value

N/A

end_at

Yes

Long

Definition

End time in the Unix timestamp format, in milliseconds

Constraints

N/A

Range

[0, 2^31 – 1]. The actual value depends on the query result.

Default Value

N/A

task_ids

No

Array of long

Definition

SQL Insight task IDs. SQL Insight tasks that span more than one day will be split for parsing. Multiple tasks can be filtered and exported at the same time.

Constraints

Multiple values need to be separated by commas (,).

Range

[0, 2^31 – 1]. The actual value depends on the query result.

Default Value

N/A

node_id

No

String

Definition

Node ID

Constraints

N/A

Range

The value can contain 32 characters. Only letters and digits are supported.

Default Value

N/A

keyword

No

String

Definition

Keyword

Constraints

Multiple values need to be separated by commas (,).

Range

N/A

Default Value

N/A

fuzzy

No

String

Definition

Whether fuzzy match is used

Constraints

N/A

Range

N/A

Default Value

N/A

user_list

No

String

Definition

Username

Constraints

Multiple values need to be separated by commas (,).

Range

N/A

Default Value

N/A

db_list

No

String

Definition

Database

Constraints

Multiple values need to be separated by commas (,).

Range

N/A

Default Value

N/A

operation_list

No

String

Definition

Operation type

Constraints

Multiple values need to be separated by commas (,).

Range

N/A

Default Value

N/A

client_ip_list

No

String

Definition

Client IP address

Constraints

Multiple values need to be separated by commas (,).

Range

N/A

Default Value

N/A

thread_id_list

No

String

Definition

Thread ID

Constraints

Multiple values need to be separated by commas (,).

Range

N/A

Default Value

N/A

trx_id_list

No

String

Definition

Transaction ID

Constraints

Multiple values need to be separated by commas (,).

Range

N/A

Default Value

N/A

session_id_list

No

String

Definition

Session ID

Constraints

Multiple values need to be separated by commas (,).

Range

N/A

Default Value

N/A

status_list

No

String

Definition

Execution status

Constraints

Multiple values need to be separated by commas (,).

Range

  • 0: successful
  • 1: failed

Default Value

N/A

sql_template_ids

No

String

Definition

SQL template ID

Constraints

Multiple values need to be separated by commas (,).

Range

N/A

Default Value

N/A

cost_min

No

Double

Definition

Minimum execution duration, in milliseconds

Constraints

N/A

Range

N/A

Default Value

N/A

cost_max

No

Double

Definition

Maximum execution duration, in milliseconds

Constraints

N/A

Range

N/A

Default Value

N/A

scan_min

No

Long

Definition

Minimum rows scanned

Constraints

N/A

Range

[0, 2^31 – 1]. The actual value depends on the query result.

Default Value

N/A

scan_max

No

Long

Definition

Maximum rows scanned

Constraints

N/A

Range

[0, 2^31 – 1]. The actual value depends on the query result.

Default Value

N/A

affect_min

No

Long

Definition

Minimum rows affected

Constraints

N/A

Range

[0, 2^31 – 1]. The actual value depends on the query result.

Default Value

N/A

affect_max

No

Long

Definition

Maximum rows affected

Constraints

N/A

Range

[0, 2^31 – 1]. The actual value depends on the query result.

Default Value

N/A

return_min

No

Long

Definition

Minimum rows returned

Constraints

N/A

Range

[0, 2^31 – 1]. The actual value depends on the query result.

Default Value

N/A

return_max

No

Long

Definition

Maximum rows returned

Constraints

N/A

Range

[0, 2^31 – 1]. The actual value depends on the query result.

Default Value

N/A

sort_field

No

String

Definition

Sorting field

Constraints

N/A

Range

  • execute_at: execution time
  • execute_cost: execution duration
  • lock_wait_time: lock wait time
  • rows_examined: scanned rows
  • rows_returned: returned rows

Default Value

N/A

asc

No

Boolean

Definition

Sorting order

Constraints

N/A

Range

  • true: ascending
  • false: descending

Default Value

N/A

page

No

Integer

Definition

Page number

Constraints

N/A

Range

[0, 2^31 – 1]. The actual value depends on the query result.

Default Value

N/A

limit

No

Integer

Definition

Number of records on each page

Constraints

N/A

Range

[0, 100]. The actual value depends on the query result.

Default Value

N/A

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

task_id

Long

Definition

Task ID

Range

N/A

Example Requests

POST https://das.cn-north-1.myhuaweicloud.com/v3/054e292c9880d4992f02c0196d3ea468/fullsql/export
 
{
  "instance_id": "17a73a23badb4c40b6ea48e7bfa5e83fin01",
  "bucket_name": "5257",
  "export_column_list": [
    "sql",
    "nodeId",
    "database",
    "threadId",
    "username",
    "clientIp",
    "operateType",
    "status",
    "errorNo",
    "executeAt",
    "executeCost",
    "rowsAffected",
    "rowsExamined",
    "lockWaitTime",
    "rowsReturned",
    "trxId",
    "cpuTime",
    "sendBytes",
    "queryTables",
    "innodbIoReadBytes",
    "innodbIoRead",
    "innodbIoReadWait",
    "innodbLockWait",
    "innodbQueueWait"
  ],
  "time_zone": "Asia/Shanghai",
  "end_at": 1764245632000,
  "start_at": 1764216832000,
  "operation_list": [],
  "fuzzy": false,
  "task_id": 1642
}

Example Responses

Status code: 200

Success.

{"task_id":3403}

Status Codes

Status Code

Description

200

Success.

400

Client error.

500

Server error.

Error Codes

See Error Codes.