View table information

View the field definitions and row numbers of the table without returning the data rows in the table.

HTTP
POST $CLOUDSIGMA_API_BASE/meta/table/info

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. View database, select the database name.

  3. Query the table and view list in the database and select the table name.

Prepare credentials with permissions on the target table SELECT. Workspace access or metadata visibility permissions cannot replace the SELECT permission.

Request body

Replace $CLOUDSIGMA_API_KEY, $WORKSPACE_ID, $DATABASE, $TABLE in the example with actual values.

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/meta/table/info" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d "{
    \"db_name\": \"$DATABASE\",
    \"table_name\": \"$TABLE\"
  }"

This interface executes SELECT COUNT(*) to obtain the number of rows, which may generate statistics overhead for the entire table. If you only need field definitions, use query table field list.

Parameter

Type

Required

Description

db_name

string

Yes

The name of the database where the table resides.

table_name

string

Yes

The name of the table to view.

Successful response

JSON
{
  "code": 200,
  "data": {
    "columns": [
      {
        "name": "id",
        "data_type": "INT",
        "nullable": "NO",
        "default_value": "",
        "key_type": "PRI",
        "comment": ""
      }
    ],
    "total": 1,
    "rows": 42
  }
}

Field

Type

Description

code

integer

200 on success.

data

object

table information.

data.columns

array of objects or null

List of column definitions. It is null if there is no column record.

data.total

integer

Number of columns.

data.rows

integer

The number of rows in the table, the data row itself is not returned.

data.columns[].name

string

Column name.

data.columns[].data_type

string

Data type.

data.columns[].nullable

string

Whether to allow null values. YES means allowed, NO means not allowed.

data.columns[].default_value

string

Default value string. SQL NULL and the true empty string default both return an empty string and cannot be distinguished by this field.

data.columns[].key_type

string

Key type.

data.columns[].comment

string

Column notes.

Error response

JSON
{
  "code": 404,
  "message": "对象不存在"
}

Field

Type

Description

code

integer or string

Error code or status code.

message

string

error message.

Last updated on