Query SQL text

2025-03-28 08:05:55  Updated

Description

You can call this operation to query complete SQL text of a specified ID.

Call description

Prerequisite

You have the read privilege on the specified tenant.

Request path

GET /api/v2/ob/clusters/{clusterId}/tenants/{tenantId}/sql/{sqlId}/text

Request parameters

Parameter Type Required Example Description
clusterId Integer Yes 1 The ID of the cluster.
tenantId Integer Yes 1001 The ID of the tenant.
sqlId String Yes C9B3A63AFF8F2A408CCF3D5B0F36682D The ID of the SQL statement.
startTime Datetime Yes 2020-02-16T05:32:16+08:00 The start time.
endTime Datetime Yes 2020-02-16T07:32:16+08:00 The end time.

Response parameters

Basic data structure

Parameter Type Description
data Object The request data.
├─ fulltext String The complete SQL text.
successful Boolean Whether the request is successful.
timestamp Datetime The timestamp when the server completes the request.
duration Integer The time that the server takes to process the request, in milliseconds.
status Integer The encoding in compliance with the HTTP Status specification.
traceId String The trace ID of the request. This trace ID is used for troubleshooting.
server String The address of the application server that responds to the request.

Examples

Sample request

Query the SQL text whose ID is C9B3A63AFF8F2A408CCF3D5B0F36682D based on the cluster ID 1 and tenant ID 1001, and set the time range to 2020-11-03T19:00:00+08:00 to 2020-11-03T20:00.

GET /api/v2/ob/clusters/1/tenants/1001/C9B3A63AFF8F2A408CCF3D5B0F36682D/text?startTime=2020-11-03T19%3A00%3A00%2B08%3A00&endTime=2020-11-03T20%3A00%3A00%2B08%3A00

Sample response

{
    "duration": 23,
    "server": "a83ad33525",
    "status": 200,
    "successful": true,
    "timestamp": "2020-11-03T21:14:53.216+08:00",
    "traceId": "60ff4f60c1e6454d",
    "data": {
        "fulltext": "SELECT 1 FROM DUAL"
    }   
}

Contact Us