获取SQL执行记录
功能介绍
查询SQL执行记录
调试
您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。
URI
GET https://localhost.com/v1/workspaces/{workspace_id}/statement-records
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
workspace_id |
是 |
String |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
endpoint_id |
否 |
String |
|
statement_id |
否 |
String |
|
limit |
否 |
Integer |
|
offset |
否 |
Integer |
|
source |
否 |
Integer |
|
start_time |
否 |
Integer |
|
end_time |
否 |
Integer |
|
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
否 |
String |
|
响应参数
状态码:200
参数 |
参数类型 |
描述 |
---|---|---|
total |
Integer |
|
records |
Array of StatementRecord objects |
sql历史记录。 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
String |
Sql执行StatementID。 |
workspace_id |
String |
|
endpoint_id |
EndpointId object |
|
database_name |
String |
|
statement_content |
String |
|
dpu_duration |
String |
|
duration |
String |
|
dpu_cost |
String |
|
status |
String |
|
create_time |
String |
|
start_time |
String |
|
finish_time |
String |
|
参数 |
参数类型 |
描述 |
---|---|---|
- |
String |
|
状态码:400
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
|
error_msg |
String |
|
solution_msg |
String |
|
状态码:401
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
|
error_msg |
String |
|
solution_msg |
String |
|
状态码:404
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
|
error_msg |
String |
|
solution_msg |
String |
|
状态码:408
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
|
error_msg |
String |
|
solution_msg |
String |
|
状态码:500
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
|
error_msg |
String |
|
solution_msg |
String |
|
请求示例
查询sql执行历史记录,返回值为sql执行的sql,开始时间,结束时间等。
GET https://endpoint/v1/workspaces/{workspace_id}/statement-records?endpoint_id= { }
响应示例
状态码:200
Sql执行历史记录响应体。
{ "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" } ] }
状态码:400
BadRequest
{ "error_code" : "common.01000001", "error_msg" : "failed to read http request, please check your input, code: 400, reason: Type mismatch., cause: TypeMismatchException" }
状态码:401
Unauthorized
{ "error_code" : "APIG.1002", "error_msg" : "Incorrect token or token resolution failed" }
状态码: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" }
状态码:404
NotFound
{ "error_code" : "common.01000001", "error_msg" : "response status exception, code: 404" }
状态码:408
Request Time-out
{ "error_code" : "common.00000408", "error_msg" : "timeout exception occurred" }
状态码:500
InternalServerError
{ "error_code" : "common.00000500", "error_msg" : "internal error" }
状态码
状态码 |
描述 |
---|---|
200 |
Sql执行历史记录响应体。 |
400 |
BadRequest |
401 |
Unauthorized |
403 |
Forbidden |
404 |
NotFound |
408 |
Request Time-out |
500 |
InternalServerError |
错误码
请参见错误码。