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
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID of a tenant in a region To obtain the 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 |
| instance_id | Yes | String | Definition Instance ID, which uniquely identifies an instance. You can obtain the instance ID from the instance list or instance details. Constraints N/A Range The value can contain 36 characters. Only letters and digits are allowed. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| range_left | No | Long | Definition Minimum start time of a task Constraints Unix timestamp, in milliseconds Range [0, 2^63 – 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^63 – 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^63 – 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^63 – 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
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
Constraints N/A Range
Default Value N/A |
| asc | No | Boolean | Definition Sorting order Constraints N/A Range
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
| Parameter | Type | Description |
|---|---|---|
| tasks | Array of objects in Table 4 | Definition SQL Insight tasks |
| total | Integer | Definition Total number Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Long | Definition Task ID Range N/A |
| instance_id | String | Definition Instance ID, which uniquely identifies an instance. You can obtain the instance ID from the instance list or instance details. Range The value can contain 36 characters. Only letters and digits are allowed. |
| instance_name | String | Definition Instance name Range N/A |
| node_id | String | Definition Unique ID of a node. You can obtain the node ID from the node list in the instance details. Range The value can contain 36 characters. Only letters and digits are allowed. |
| 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 |
| keyword | Array of strings | Definition Keyword |
| db_list | Array of strings | Definition Database |
| operation_list | Array of strings | Definition Operation type
|
| thread_id_list | Array of strings | Definition Thread ID |
| trx_id_list | Array of strings | Definition Transaction ID |
| status_list | Array of strings | Definition Execution status
|
| sql_template_ids | Array of strings | Definition SQL template ID |
| status | Integer | Definition Task status Range
|
| 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
Success.
{
"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 | Success. |
| 400 | Client error |
| 500 | Server error |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot