Querying SQL Execution Records
Function
This API is used to query SQL execution records.
URI
GET /v1/workspaces/{workspace_id}/statement-records
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
workspace_id |
Yes |
String |
Definition: Workspace ID. Constraints: N/A. Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed. Default Value: N/A. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
endpoint_id |
No |
String |
Definition: Endpoint ID, allowing you to search for endpoints by their ID. Constraints: N/A. Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed. Default Value: N/A. |
statement_id |
No |
String |
Definition: Statement ID. Constraints: N/A. Range: 1 to 64 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. Default Value: N/A. |
limit |
No |
Integer |
Definition: Maximum number of records returned on each page. Constraints: N/A. Range: [1, 100]. Default Value: 10. |
offset |
No |
Integer |
Definition: Offset where a query starts. Constraints: N/A. Range: [0, 1000000000]. Default Value: 0. |
source |
No |
Integer |
Definition: Source of the SQL statement to be executed. 0: API; 1: console. Constraints: N/A. Range: N/A. Default Value: N/A. |
start_time |
No |
Integer |
Definition: Query start time. Constraints: N/A. Range: N/A. Default Value: N/A. |
end_time |
No |
Integer |
Definition: Query completion time. Constraints: N/A. Range: N/A. Default Value: N/A. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
No |
String |
Definition: Tenant token. Constraints: N/A. Range: N/A. Default Value: N/A. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
total |
Integer |
Definition: Total number of SQL statements that meet the filter criteria. Constraints: N/A. Range: N/A. Default Value: N/A. |
records |
Array of StatementRecord objects |
SQL history records. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Statement ID for SQL execution. |
workspace_id |
String |
Definition: Workspace ID. Constraints: N/A. Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed. Default Value: N/A. |
endpoint_id |
String |
|
database_name |
String |
Definition: Database name. Constraints: N/A. Range: 1 to 256 characters. Only letters, digits, and underscores (_) are allowed. Default Value: N/A. |
statement_content |
String |
Definition: SQL script content. Constraints: N/A. Range: 1 to 1,024 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. Default Value: N/A. |
dpu_duration |
String |
Definition: Data processing unit (DPU) duration. Constraints: N/A. Range: N/A. Default Value: N/A. |
duration |
String |
Definition: Execution duration. Constraints: N/A. Range: N/A. Default Value: N/A. |
dpu_cost |
String |
Definition: Cost. Constraints: N/A. Range: N/A. Default Value: N/A. |
status |
String |
Definition: SQL execution status. - CANCELED: canceled. - FAILED: failed. - SUCCESSFUL: successful. - RUNNING: running. - SUBMITTED: being submitted. - ERROR: error occurred. Constraints: N/A. Range: CANCELED, FAILED, SUCCESSFUL, RUNNING, SUBMITTED, or ERROR. Default Value: N/A. |
user_name |
String |
|
create_time |
String |
Definition: Creation time. Constraints: N/A. Range: N/A. Default Value: N/A. |
start_time |
String |
Definition: SQL execution start time. Constraints: N/A. Range: N/A. Default Value: N/A. |
finish_time |
String |
Definition: SQL execution end time. Constraints: N/A. Range: N/A. Default Value: N/A. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition: Error code. Constraints: N/A. Range: [8, 36]. Default Value: N/A. |
error_msg |
String |
Definition: Error message. Constraints: N/A. Range: [2, 4096]. Default Value: N/A. |
solution_msg |
String |
Definition: Solution description. Constraints: N/A. Range: [2, 4096]. Default Value: N/A. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition: Error code. Constraints: N/A. Range: [8, 36]. Default Value: N/A. |
error_msg |
String |
Definition: Error message. Constraints: N/A. Range: [2, 4096]. Default Value: N/A. |
solution_msg |
String |
Definition: Solution description. Constraints: N/A. Range: [2, 4096]. Default Value: N/A. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition: Error code. Constraints: N/A. Range: [8, 36]. Default Value: N/A. |
error_msg |
String |
Definition: Error message. Constraints: N/A. Range: [2, 4096]. Default Value: N/A. |
solution_msg |
String |
Definition: Solution description. Constraints: N/A. Range: [2, 4096]. Default Value: N/A. |
Status code: 408
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition: Error code. Constraints: N/A. Range: [8, 36]. Default Value: N/A. |
error_msg |
String |
Definition: Error message. Constraints: N/A. Range: [2, 4096]. Default Value: N/A. |
solution_msg |
String |
Definition: Solution description. Constraints: N/A. Range: [2, 4096]. Default Value: N/A. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition: Error code. Constraints: N/A. Range: [8, 36]. Default Value: N/A. |
error_msg |
String |
Definition: Error message. Constraints: N/A. Range: [2, 4096]. Default Value: N/A. |
solution_msg |
String |
Definition: Solution description. Constraints: N/A. Range: [2, 4096]. Default Value: N/A. |
Example Requests
Query the SQL execution history. The returned values include the executed SQL statement, start time, and end time.
GET https://endpoint/v1/workspaces/{workspace_id}/statement-records?endpoint_id= { }
Example Responses
Status code: 200
Historical SQL statement execution records are queried.
{ "total" : 1, "records" : [ { "id" : "0b5633ba2b904511ad514346f4dxxxxx", "workspace_id" : "0b5633ba2b904511ad514346f4d23d4b", "endpoint_id" : "0b5633ba2b904511ad514346f4d23d4b", "database_name" : "db1", "statement_content" : "select 1", "dpu_duration" : 2.23, "dpu_cost" : 10.11, "duration" : 332, "status" : "SUCCESSFUL", "create_time" : "2023-05-30T12:24:30.401Z", "start_time" : "2023-05-30T12:24:30.401Z", "finish_time" : "2023-05-30T12:24:30.401Z" } ] }
Status code: 400
BadRequest
{ "error_code" : "common.01000001", "error_msg" : "failed to read http request, please check your input, code: 400, reason: Type mismatch., cause: TypeMismatchException" }
Status code: 401
Unauthorized
{ "error_code" : "APIG.1002", "error_msg" : "Incorrect token or token resolution failed" }
Status code: 403
Forbidden
{ "error" : { "code" : "403", "message" : "X-Auth-Token is invalid in the request", "title" : "Forbidden" }, "error_code" : 403, "error_msg" : "X-Auth-Token is invalid in the request", "title" : "Forbidden" }
Status code: 404
NotFound
{ "error_code" : "common.01000001", "error_msg" : "response status exception, code: 404" }
Status code: 408
Request Time-out
{ "error_code" : "common.00000408", "error_msg" : "timeout exception occurred" }
Status code: 500
InternalServerError
{ "error_code" : "common.00000500", "error_msg" : "internal error" }
Status Codes
Status Code |
Description |
---|---|
200 |
Historical SQL statement execution records are queried. |
400 |
BadRequest |
401 |
Unauthorized |
403 |
Forbidden |
404 |
NotFound |
408 |
Request Time-out |
500 |
InternalServerError |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank 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