Query table information

Query table definition, table creation SQL and statistical information.

HTTP
POST $CLOUDSIGMA_API_BASE/catalog/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. First query the object in the database to obtain the target table ID, or prepare the table name and database positioning parameters. Prepare the personal access token, target workspace ID, and table location information that can access the target workspace.

Request body

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/catalog/table/info" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "id": '"$TABLE_ID"'
  }'

The request can be queried by table ID, or by table name plus database ID/system database name.

Field

Type

Required

Description

id

integer condition required

No

Table ID. You do not need to pass the name after providing it.

name

string condition is required

No

Table name. Required when id is not provided.

database_id

integer condition required

No

The database ID of the non-system database. Mutually exclusive with database_name.

database_name

string condition is required

No

System database name. Mutually exclusive with database_id.

include_stats

boolean

No

Whether to return column statistics.

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "name": "orders",
    "lines": 120,
    "size": 4096,
    "created_at": 1735689600,
    "updated_at": 1735689600,
    "created_by": "user@example.com",
    "description": "订单表",
    "comment": "订单明细",
    "columns": [
      {
        "name": "id",
        "type": "INT",
        "is_pk": true
      }
    ],
    "create_sql": "CREATE TABLE orders (id INT PRIMARY KEY)",
    "stats": [
      {
        "name": "id",
        "type": "INT",
        "max_value": "100",
        "min_value": "1"
      }
    ]
  }
}

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data.name

string

Table name.

data.lines

integer

Number of table rows.

data.size

integer

Table size, in bytes.

data.created_at

integer

Unix timestamp of creation time in seconds.

data.updated_at

integer

Unix timestamp of the update time in seconds.

data.created_by

string

Creator ID.

data.description

string

Table description.

data.comment

string

Table comments.

data.columns

array of object

Column definition.

data.create_sql

string

Create table SQL.

data.stats

array of object

Column statistics.

data.columns[].name

string

Column name.

data.columns[].type

string

Full SQL data type, including precision information where applicable.

data.columns[].is_pk

boolean

Whether it is a primary key column. Returned if there is a value.

data.columns[].comment

string

Column comments. Returned if there is a value.

data.columns[].default

string

Column default value. Returned if there is a value.

data.stats[].name

string

Column name.

data.stats[].type

string

Full SQL data type, including precision information where applicable.

data.stats[].is_pk

boolean

Whether it is a primary key column. Returned if there is a value.

data.stats[].default

string

Column default value. Returned if there is a value.

data.stats[].comment

string

Column comments. Returned if there is a value.

data.stats[].max_value

string

The maximum value of the column.

data.stats[].min_value

string

The minimum value of the column.

Error response

JSON
{
  "code": "ErrParamInvalid",
  "msg": "表定位参数无效"
}

Field

Type

Description

code

string

error code.

msg

string

error message.

Last updated on