Help Center/ AI DataLake/ API Reference/ Aura APIs/ AuraSQL Job Management/ Viewing the Execution Result of a SQL Statement
Updated on 2026-11-06 GMT+08:00

Viewing the Execution Result of a SQL Statement

Function

Query the execution result of a SQL statement.

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/{statement_id}

Table 1 Path Parameters

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

statement_id

Yes

String

Definition: Statement ID, which can be obtained 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

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

page_num

No

Integer

Definition: Query page number.

Constraints: N/A

Range: 1 to 2147483647.

Default Value: N/A

is_enable_obs_path

No

Boolean

Definition: Whether to return the OBS path of a result set.

Constraints: N/A

Range

  • true: Result the OBS path of the result set.

  • false: Return the result set.

Default Value: N/A

Request Parameters

Table 3 Request header 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

Table 4 Response body parameters

Parameter

Type

Description

status

Integer

Definition: Statement status.

Range

  • 0: Succeeded.

  • -1: Failed.

  • 1: Executing.

  • 2: Execution completed with no result set.

  • 3: Queued and waiting.

  • 4: Statement not executed properly.

session_id

String

Definition: Session ID.

Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed.

statement_id

String

Definition: Statement ID.

Range: 1 to 36 characters. Only letters, digits, and underscores (_) are allowed.

results

Array of results objects

Definition: List of statement execution results, returned in the order of execution.

Table 5 results

Parameter

Type

Description

status

String

Definition: SQL execution result status.

Range: PGRES_TUPLES_OK (query successful with result set), PGRES_COMMAND_OK (command executed successfully without result set), PGRES_FATAL_ERROR (query failure).

statement_id

String

Definition: Unique identifier of this statement execution.

Range: UUID.

num_rows

Long

Definition: Number of rows in the result set.

Range: N/A

row_count

Long

Definition: Number of affected rows.

Range: N/A

page_count

Integer

Definition: Total number of pages.

Range: N/A

page_no

Integer

Definition: Current page number.

Range: N/A

err_code

String

Definition: Error code.

Range: 0 (success).

sql_state

String

Definition: SQL status code.

Range: N/A

message

String

Definition: Execution message.

result_set

result_set object

Definition: Result set. Contains valid data only when the query succeeds (PGRES_TUPLES_OK). Otherwise, it is an empty object {}.

Table 6 result_set

Parameter

Type

Description

columns

Array of columns objects

Definition: Column metadata list.

rows

Array<Array<String>>

Definition: Actual data rows. The order of each row corresponds to the columns.

Table 7 columns

Parameter

Type

Description

name

String

Definition: Column name.

Range: 1 to 64 characters.

table_id

Integer

Definition: Table ID.

column_id

Integer

Definition: Column ID.

format

Integer

Definition: Format.

type

Integer

Definition: Column type OID.

size

Integer

Definition: Column size.

type_mod

Integer

Definition: Type modifier.

Status code: 400

Table 8 Response body parameters

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

Table 9 Response body parameters

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

Table 10 Response body parameters

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

Table 11 Response body parameters

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

Table 12 Response body parameters

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

Table 13 Response body parameters

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 the execution result of a SQL statement.

GET /v2/workspaces/{workspace_id}/aura-sessions/{session_id}/statements/{statement_id}

Example Responses

Status code: 200

{
  "status" : 0,
  "session_id" : "6399466e-8908-4c9d-8399-48479c8b06f7",
  "statement_id" : "49131d25-1824-4f29-860c-832bdd19dfd3",
  "results" : [ {
    "status" : "PGRES_TUPLES_OK",
    "statement_id" : "49131d25-1824-4f29-860c-832bdd19dfd3",
    "num_rows" : 2,
    "row_count" : 2,
    "page_count" : 1,
    "page_no" : 1,
    "err_code" : "0",
    "sql_state" : "0",
    "message" : "",
    "result_set" : {
      "columns" : [ {
        "name" : "a",
        "table_id" : 2147483647,
        "column_id" : 1,
        "format" : 0,
        "type" : 23,
        "size" : 4,
        "type_mod" : -1
      }, {
        "name" : "b",
        "table_id" : 2147483647,
        "column_id" : 2,
        "format" : 0,
        "type" : 23,
        "size" : 4,
        "type_mod" : -1
      } ],
      "rows" : [ [ "1", "2" ], [ "1", "2" ] ]
    }
  } ]
}

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.