Updated on 2026-01-20 GMT+08:00

Querying SQL Insight Tasks

Function

After Collect All Query Logs is enabled, you can query SQL Insight tasks. This function is available only for paid instances.

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:listFullSql

    List

    Instance

    -

    das:clouddba:fullSqlList

    -

URI

GET /v3/{project_id}/instances/{instance_id}/full-sql-tasks

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, including only letters and digits.

Default Value

N/A

instance_id

Yes

String

Definition

Unique ID of an instance

Constraints

N/A

Range

The value can contain 32 characters, including only letters and digits.

Default Value

N/A

Table 2 Query parameters

Parameter

Mandatory

Type

Description

range_left

No

Long

Definition

Minimum start time of a task

Constraints

Unix timestamp, in milliseconds

Range

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

Default Value

N/A

range_right

No

Long

Definition

Maximum start time and end time of a task

Constraints

Unix timestamp, in milliseconds

Range

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

Default Value

N/A

create_at_left

No

Long

Definition

Minimum creation time of a task

Constraints

Unix timestamp, in milliseconds

Range

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

Default Value

N/A

create_at_right

No

Long

Definition

Maximum creation time of a task

Constraints

Unix timestamp, in milliseconds

Range

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

Default Value

N/A

user

No

String

Definition

Username

Constraints

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

Range

N/A

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

db_name

No

String

Definition

Database name

Constraints

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

Range

N/A

Default Value

N/A

operation

No

String

Definition

Operation type

Constraints

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

Range

N/A

Default Value

N/A

thread_id

No

String

Definition

Thread ID

Constraints

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

Range

N/A

Default Value

N/A

trx_id

No

String

Definition

Transaction ID

Constraints

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

Range

N/A

Default Value

N/A

status

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_id

No

String

Definition

SQL template ID

Constraints

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

Range

N/A

Default Value

N/A

sort_field

No

String

Definition

Sorting field

  • create_at: task creation time
  • range_start_at and range_end_at: start time and end time of a task

Constraints

N/A

Range

  • create_at: task creation time
  • range_start_at and range_end_at: start time and end time of a task

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

Records on each page

Constraints

N/A

Range

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

Default Value

N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

tasks

Array of Table 4 objects

Definition

SQL Insight tasks

Range

N/A

total

Integer

Definition

Total number

Range

N/A

Table 4 FullSqlTask

Parameter

Type

Description

id

Long

Definition

Task ID

Range

N/A

instance_id

String

Definition

Instance ID

Range

N/A

instance_name

String

Definition

Instance name

Range

N/A

node_id

String

Definition

Node ID

Range

N/A

start_at

Long

Definition

Start time in the Unix timestamp format, in milliseconds

Range

N/A

end_at

Long

Definition

End time in the Unix timestamp format, in milliseconds

Range

N/A

batch_id

String

Definition

Batch ID

Range

N/A

user_list

Array of strings

Definition

Username

Range

N/A

keyword

Array of strings

Definition

Keyword

Range

N/A

db_list

Array of strings

Definition

Database

Range

N/A

operation_list

Array of strings

Definition

Operation type

Range

  • insert
  • delete
  • update
  • select
  • show
  • create
  • drop
  • alter
  • set
  • replace
  • use
  • start: Start a transaction.
  • commit: Commit a transaction.
  • rollback: Roll back a transaction.
  • truncate
  • begin: Start a transaction.
  • call: Call a stored procedure.

thread_id_list

Array of strings

Definition

Thread ID

Range

N/A

trx_id_list

Array of strings

Definition

Transaction ID

Range

N/A

status_list

Array of strings

Definition

Execution status

Range

  • 0: successful
  • 1: failed

sql_template_ids

Array of strings

Definition

SQL template ID

Range

N/A

status

Integer

Definition

Task status

Range

  • 0: waiting for parsing
  • 1: parsing
  • 2: parsing completed
  • –1: failed

progress

Double

Definition

Task progress

Range

[0,100]

reason

String

Definition

Failure cause

Range

N/A

create_at

Long

Definition

Creation time in the Unix timestamp format, in milliseconds

Range

N/A

update_at

Long

Definition

Update time in the Unix timestamp format, in milliseconds

Range

N/A

Example Requests

GET https://das.cn-north-1.myhuaweicloud.com/v3/054e292c9880d4992f02c0196d3ea468/instances/da304cd5bbb944de828759bc7be3d3fein01/full-sql-tasks

Example Responses

Status code: 200

Successful response

{
  "tasks": [
    {
      "id": 1128,
      "instance_id": "da304cd5bbb944de828759bc7be3d3fein01",
      "start_at": 1738717200000,
      "end_at": 1738720800000,
      "status": 2,
      "progress": 100,
      "create_at": 1738740285113,
      "update_at": 1738740294826
    }
  ],
  "total": 1
}

Status Codes

Status Code

Description

200

Successful response

400

Client error

500

Server error

Error Codes

See Error Codes.