Help Center/ Data Admin Service/ API Reference/ APIs/ Intelligent O&M/ Obtaining Full SQL Query Samples
Updated on 2026-08-25 GMT+08:00

Obtaining Full SQL Query Samples

Function

This API is used to obtain full SQL query samples.

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, the permission listed below is required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    das:clouddba:listTopSql

    read

    instance

    -

    -

    -

URI

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

Table 1 URI parameters

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 allowed.

Default Value

N/A

instance_id

Yes

String

Definition

Instance ID, which uniquely identifies an instance.

Constraints

N/A

Range

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

Default Value

N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

sql_template_id

Yes

String

Definition

SQL template ID.

Constraints

N/A

Range

N/A

Default Value

N/A

start_at

Yes

Long

Definition

Start timestamp (ms).

Constraints

N/A

Range

N/A

Default Value

N/A

end_at

Yes

Long

Definition

End timestamp (ms).

Constraints

N/A

Range

N/A

Default Value

N/A

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

sample

Table 4

Definition

Full SQL query sample.

Range

N/A

Table 4 sample

Parameter

Type

Description

sql

String

Definition

SQL statement.

Range

N/A

sql_template_id

String

Definition

SQL template.

Range

N/A

database

String

Definition

Database name.

Range

N/A

client

String

Definition

Client address.

Range

N/A

user

String

Definition

Username.

Range

N/A

execute_at

Long

Definition

Execution time.

Range

N/A

query_time

Double

Definition

Execution duration (ms).

Range

N/A

lock_time

Double

Definition

Lock wait time (ms).

Range

N/A

Example Requests

GET https://das.cn-north-1.myhuaweicloud.com/v3/052041494800d57c2f02c00275b4c247/instances/bcfa975193f1402fa11a6d4fd6baf5fbin01/full-sql-sample?start_at=1764013979175&end_at=1764057179175&sql_template_id=CBCE02C9FC9D77DA 
 

Example Responses

Status code: 200

Success.

{
    "sample": {
        "sql": "/* sql from das */TRUNCATE `cmdb_data-tunnel`.`cmdb_data`",
        "sql_template_id": "CBCE02C9FC9D77DA",
        "database": "",
        "client": "100.79.0.248",
        "user": "root",
        "execute_at": 1764035776247,
        "query_time": 56,
        "lock_time": 0
    }
}

Status Codes

Status Code

Description

200

Success.

400

Client error.

500

Server error.

Error Codes

See Error Codes.