SQL 执行历史

获取某个用户在集群的 SQL 执行历史,最多展示最近的10条

接口URL

/api/v1/dms/sqleditor/statements?clusterID=&userID=

请求方式

GET

Content-Type

application/json

认证方式

Bearer auth

请求Query参数

参数名 示例值 参数类型 是否必填 参数描述
clusterID tidb-f91e1f860d360502 Text cluster ID
userID haibo Text user ID

成功响应示例

{
    "Data": {
        "statementResults": [
            {
                "ResultID": "stmt-8051341647989475",
                "clusterID": "tidb-f91e1f860d360502",
                "execPlan": {
                    "columns": null,
                    "rows": null,
                    "matrix": true,
                    "msg": "",
                    "summary": "Query OK!"
                },
                "execInfo": {
                    "startTime": "2023-09-21T15:23:34.208742681+08:00",
                    "endTime": "2023-09-21T15:23:34.210476396+08:00",
                    "executeTime": "0.002 s",
                    "query": "SELECT * FROM regions;",
                    "limit": 1000,
                    "rowCount": 5
                },
                "resultSet": {
          "code": 0, // 0 表示成功,非 0 表示失败(比如下面 msg )
                    "columns": null,
                    "rows": null,
                    "matrix": true,
                    "msg": "",
                    "summary": "Query OK!"
                },
                "database": "test",
                "userID": "haibo"
            },
        ]
    },
    "Success": true
}
参数名 示例值 参数类型 参数描述
code - String
data.statementResults - Array
data.statementResults.clusterID - String 集群 ID
data.statementResults.database - String 所在数据库
data.statementResults.execInfo.endTime - String 执行结束时间
data.statementResults.execInfo.executeTime - String 执行耗时
data.statementResults.execInfo.limit - Integer 限制条数
data.statementResults.execInfo.query - String 执行语句
data.statementResults.execInfo.rowCount - Integer 返回行数
data.statementResults.execInfo.startTime - String 执行开始时间
data.statementResults.execPlan.matrix - Boolean 是否存在执行计划
data.statementResults.execPlan.msg - String 若无执行计划,输出日志
data.statementResults.execPlan.summary query failed/Duration 10ms String
data.statementResults.resultID - String
data.statementResults.resultSet.code 0 Integer 0 表示成功,非 0 表示失败(比如下面 msg 的 1064)
data.statementResults.resultSet.matrix - Boolean
data.statementResults.resultSet.msg - String
data.statementResults.resultSet.summary query failed/Duration 10ms String
data.statementResults.userID - String
message - String
success - Boolean
© 2024 平凯星辰(北京)科技有限公司 all right reserved,powered by GitbookFile Modify: 2024-04-15 13:33:32

results matching ""

    No results matching ""