View execution result

Reads the result rows of a SQL query that completed successfully. When you need to download the complete results, please use Download SQL execution results.

HTTP
POST $CLOUDSIGMA_API_BASE/query/result

Before you call

Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region.

  1. Prepare personal access token and target workspace ID that can access the target workspace.

  2. Query the SQL execution status, confirm that the query is successful, and record the result ID (statement_id) in the response.

Only the results of queries created and successfully completed by the current identity can be read.

Request body

Replace $CLOUDSIGMA_API_KEY, $WORKSPACE_ID and $STATEMENT_ID with actual values.

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/query/result" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d "{\"statement_id\": \"$STATEMENT_ID\", \"offset\": 0, \"limit\": 20}"

Parameter

Type

Required

Description

statement_id

string

Yes

The result ID of a successful execution of the view.

offset

integer

No

The line position to start reading, starting from 0.

limit

integer

No

The maximum number of rows returned this time. When 0 is not provided or is less than or equal to 0, the server uses 1000.

Successful response

JSON
{
  "code": 200,
  "data": {
    "query_id": "query_01",
    "db_name": "",
    "statement_id": "00000000-0000-4000-8000-000000000001",
    "status": "success",
    "offset": 0,
    "limit": 20,
    "total": 1,
    "columns": [
      {
        "name": "n",
        "type": "INT64"
      }
    ],
    "result": [
      [
        {
          "String": "1",
          "Valid": true
        }
      ]
    ]
  }
}

Field

Type

Description

code

integer

200 when the request is processed successfully.

data

object

response data.

data.query_id

string

The ID of the query that produced the result. Can be omitted if not set.

data.db_name

string

Currently fixed to an empty string. The database name at execution time is read from the execution status interface.

data.statement_id

string

Statement ID of this result.

data.status

string

success when the result is read successfully.

data.err_msg

string

Execute error description. May be omitted if not set.

data.offset

integer

The line position where reading starts this time.

data.limit

integer

The maximum number of rows returned for this request.

data.total

integer

The number of rows returned this time.

data.columns

array of object

Returns column definitions in the same order as the cells in each row of results. Can be omitted if not set.

data.columns[].name

string

Name.

data.columns[].type

string

Operation type.

data.result

array of array of object

A two-dimensional array of query results. Can be omitted if not set.

data.empty_set

object

Empty result description. Can be omitted if not set.

data.empty_set.msg

string

Description text.

Error response

JSON
{
  "code": 404,
  "message": "SQL 查询结果不存在"
}

Field

Type

Description

code

integer or string

SQL processing errors may be numeric status codes. Authentication or general service errors may be string error codes.

message

string

error message.

Errors are encapsulated in two ways: The SQL processing path uses {“code”:400,”message”:”…”}. Authentication or general service error using {“code”:”ErrServer”,”msg”:”…”}. Both message and msg are readable error messages, which should be read based on the actual fields and cannot be judged only by the numerical code.

Last updated on