Batch query table information¶
Batch query table definitions and metadata by table ID.
POST https://moi.matrixorigin.cn/newmoi/catalog/table/multi_info
Preparation before calling¶
First query the object in the database to obtain the table ID. Prepare a list of personal access tokens, target workspace IDs, and table IDs that have 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/multi_info" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"ids": ['"$TABLE_ID"']
}'
Request body¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
integer[] |
Yes |
List of table IDs to query. |
[] after a type means an array. For example, integer[] is an array of integers.
Successful response¶
On success, 200 and information about each table are returned.
{
"code": "OK",
"msg": "OK",
"data": {
"tables": [
{
"name": "orders",
"columns": [],
"create_sql": "CREATE TABLE orders (...)"
}
]
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
array |
Queryed table information. |
|
string |
Table name. |
|
integer |
Number of table rows. |
|
integer |
Table size. |
|
array |
Column definition. |
|
string |
Create table SQL. |
|
array |
Column statistics. |
Error response¶
{
"code": "ErrServer",
"msg": "服务器内部错误",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
Invalid table ID list. |
Check |
|
|
The current identity does not have permission to read some or all of the tables. |
Use credentials with read permissions. |
|
|
The server failed to read table information. |
Try again later. |