Query table information¶
Query table definition, table creation SQL, statistics and other information.
POST https://moi.matrixorigin.cn/newmoi/catalog/table/info
Preparation before calling¶
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 has access to the target workspace.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed throughX-Workspace-IDHeader.$TABLE_ID: The table ID to be queried.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/catalog/table/info" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"id": '"$TABLE_ID"'
}'
Request body¶
The request can be queried by table ID, or by table name plus database ID/system database name.
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
Conditionally required |
Table ID. You do not need to pass the name after providing it. |
|
string |
Conditionally required |
Table name; required if |
|
integer |
Conditionally required |
Database ID of non-system database; mutually exclusive with |
|
string |
Conditionally required |
System database name; mutually exclusive with |
|
boolean |
No |
Whether to return column statistics. |
Successful response¶
Returns 200 and table information on success. Returns 403 when there is no read permission.
{
"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"
}
]
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
string |
Table name. |
|
integer |
Number of table rows. |
|
integer |
Table size in bytes. |
|
integer |
Unix timestamp of creation time in seconds. |
|
integer |
Unix timestamp of the update time in seconds. |
|
string |
Creator ID. |
|
string |
Table description. |
|
string |
Table comment. |
|
array |
Column definition. Each item contains |
|
string |
Create table SQL. |
|
array |
Column statistics; each item includes column name, type, primary key identifier, default value, comment, and maximum and minimum values. |
Error response¶
{
"code": "ErrParamInvalid",
"msg": "表定位参数无效",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
No valid table positioning method is provided, or |
Use a table ID, or just a name targeting method. |
|
|
The current identity does not have table read permission. |
Check workspace and table authorizations. |
|
|
The system database does not support the current read path. |
Use supported table positioning methods instead. |
|
|
The service cannot read table information. |
Record the request time and error message and try again; if it continues to fail, contact support. |
Follow-up operations¶
When modifications are needed Update database. When returning the list Query file products.