Viewing SQL Execution Records Under a Specified Session
Function
This API is used to query SQL execution records under a specified session.
This API is synchronous. There are no accompanying APIs or specific scenarios.
Calling Method
For details, see Calling APIs.
URI
GET /v2/workspaces/{workspace_id}/aura-sessions/{session_id}/statements
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| workspace_id | Yes | String | Definition: Workspace ID. For details about how to obtain the workspace ID, see Obtaining a Workspace ID. Constraints: N/A Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed. Default Value: N/A |
| session_id | Yes | String | Definition: Session ID. You can obtain the session ID by calling the Listing Sessions API. Constraints: N/A Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed. Default Value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| limit | No | Integer | Definition: Maximum number of records returned per page. Constraints: N/A Range: 1 to 100. Default Value: 10. |
| marker | No | String | Definition: ID of the last record on the previous page. Pass an empty value for the first page query. Constraints: N/A Range: 1 to 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. Default Value: N/A |
| statement_id | No | String | Definition: Statement ID. You can obtain the statement ID by calling the Viewing SQL Execution Records Under a Specified Session API. Constraints: N/A Range: 1 to 36 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. Default Value: N/A |
| status | No | String | Definition: Status filtering. Only one status can be queried. By default, all statuses are queried. Constraints: N/A Range Default Value: If not specified, all statuses are queried. |
| statement_type | No | String | Definition: Job type filter (SQL/JOB). If not specified, all types are returned. Constraints: N/A Range: SQL, JOB. Default Value: N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition: User token. It is obtained by calling the Obtaining an IAM User Token API. Constraints: N/A Range: N/A Default Value: N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| records | Array of SessionStatementRecord objects | Definition: Records for this query. Range: N/A |
| current_count | Integer | Definition: Total number of records for this query. Range: 1 to 2147483647. |
| next_marker | String | Definition: Marker value for the next page query. An empty value indicates the current page is the last. Range: 1 to 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. |
| Parameter | Type | Description |
|---|---|---|
| statement_id | String | Definition: Statement ID. Range: 1 to 36 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. |
| statement_content | String | Definition: Query statement. Range: N/A |
| create_time | String | Definition: Creation time, in ISO 8601 standard format. For example, 2023-05-30T12:24:30.401Z. Range: N/A |
| status | String | Definition: Status. Range |
| user_name | String | Definition: Username. Range: 1 to 64 characters. Only letters, digits, and underscores (_) are allowed. |
| tuple_processed | Long | Definition: Number of rows processed. Returned only for JOB type; returns null for SQL type. Range: N/A |
| statement_type | String | Definition: Job type (SQL/JOB). Range: SQL, JOB. |
| statement_name | String | Definition: Job name. Range: N/A |
| error | ErrorMessage object | Definition: Error object returned on failure, including the error code, error description, and solution. Range: N/A |
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 4,096 characters. |
| solution_msg | String | Definition: Solution description. Range: 2 to 4,096 characters. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 4,096 characters. |
| solution_msg | String | Definition: Solution description. Range: 2 to 4,096 characters. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 4,096 characters. |
| solution_msg | String | Definition: Solution description. Range: 2 to 4,096 characters. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 4,096 characters. |
| solution_msg | String | Definition: Solution description. Range: 2 to 4,096 characters. |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 4,096 characters. |
| solution_msg | String | Definition: Solution description. Range: 2 to 4,096 characters. |
Status code: 408
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 4,096 characters. |
| solution_msg | String | Definition: Solution description. Range: 2 to 4,096 characters. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 4,096 characters. |
| solution_msg | String | Definition: Solution description. Range: 2 to 4,096 characters. |
Example Requests
Query SQL execution history records.
GET /v2/workspaces/{workspace_id}/aura-sessions/{session_id}/statements Example Responses
Status code: 200
{
"records" : [ {
"statement_id" : "4272****02409",
"statement_content" : "select 1",
"create_time" : "2025-07-22T08:44:00.000+00:00",
"status" : "FAILED",
"user_name" : "example"
}, {
"statement_id" : "ba5e****78fd",
"statement_content" : "select 1",
"create_time" : "2025-07-22T08:43:58.000+00:00",
"status" : "SUCCESSFUL",
"user_name" : "example"
} ],
"current_count" : 2,
"next_marker" : null
} Status code: 400
{
"error_code" : "AIDataLake.00092031",
"error_msg" : "Invalid parameter name",
"solution_msg" : "Please enter parameters in the correct format."
} Status code: 401
{
"error_code" : "APIG.1002",
"error_msg" : "Incorrect token or token resolution failed.",
"solution_msg" : "Please obtain a valid token and retry."
} Status code: 403
{
"error_code" : "AIDataLake.00090030",
"error_msg" : "Unauthorized requests.",
"solution_msg" : "Check permissions and retry after authorization."
} Status code: 404
{
"error_code" : "AIDataLake.00090009",
"error_msg" : "The resource does not exists.",
"solution_msg" : "Please try to use correct info."
} Status code: 408
{
"error_code" : "common.00000408",
"error_msg" : "A timeout exception occurred.",
"solution_msg" : "The request timed out while waiting for a response — check the backend service status and network, then retry; if the operation is long-running, increase the client timeout or split the request."
} Status code: 500
{
"error_code" : "common.00000500",
"error_msg" : "internal error",
"solution_msg" : "An internal service error occurred. Please retry later; if the problem persists, contact technical support."
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Request succeeded. |
| 400 | Invalid request. |
| 401 | Unauthorized. |
| 403 | Request denied. |
| 404 | The requested resource could not be found. |
| 408 | Request timeout. |
| 500 | Internal server error. |
What is your overall rating for this page?
Thank 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