View execution status¶
Read the status and result ID of the SQL executed by the current identity (statement_id). Results can only be read or downloaded using this result ID if the status is success.
POST https://moi.matrixorigin.cn/newmoi/query/describe
Preparation before calling¶
Prepare the personal access token, workspace ID, and query ID from the Execute SQL response.
Request body¶
query_idstringRequired- The query ID returned by [Execute SQL](execute-sql.md).
Request example
curl -X POST "https://moi.matrixorigin.cn/newmoi/query/describe" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d "{\"query_id\":\"$QUERY_ID\"}"
Successful response¶
statement_id is used to read or download results and cannot be replaced by query_id. When the status is success, the Statement ID can be used to obtain the result.
The response fields are as follows.
codeinteger- 200 on success.
data.query_idstring- Query ID.
data.created_atstring- The creation time of the execution record.
data.statement_idstring- Result ID; used when reading or downloading the results of this SQL.
data.db_namestring- The database specified during execution.
data.statusstring- Execution status.
data.err_msgstring- Execution error message; only returned if there is an error message.
data.rows_affectedinteger- Number of affected rows.
Successful response example
{
"code": 200,
"data": {
"query_id": "query_01",
"created_at": "2026-08-18T10:00:00Z",
"statement_id": "statement_01",
"db_name": "sales",
"status": "success",
"rows_affected": 1
}
}
Error response¶
codestring- Error code.
msgstring- Readable error message.
datanull- `null` in an error response.
Error response example
{"code": 404, "message": "SQL 查询不存在"}
Follow-up operations¶
When the status indicates success, use the returned result to identify query execution result or download execution result. Cancel execution while still executing and needs to be aborted.
Last updated on