View tables and views in a database¶
View tables and views in a database. Use the returned object name to view fields, table information, or table creation statements.
POST $CLOUDSIGMA_API_BASE/meta/db/table
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
You can first query database to confirm the name.
Request¶
Replace caller-specific values in the example with actual values.
curl -X POST "$CLOUDSIGMA_API_BASE/meta/db/table" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d "{\"name\":\"$DATABASE\"}"
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Required | The name of the database to be queried. |
Successful response¶
{
"code": 200,
"data": {
"db_name": "sales",
"tables": {"tables": [{"name": "orders", "owner": "", "created": "", "rows": 0, "size": 0}], "total": 1},
"views": {"tables": [], "total": 0}
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
string |
The name of the database being queried. |
|
array of object or null |
Table list. The service may return |
|
array of object or null |
View list. The service may return |
|
integer |
Number of objects in the table list. |
|
integer |
Number of objects in the view list. |
|
string |
Table name; used to query table information, fields or table creation statements. |
|
string |
View name; used to view table creation statements or delete views. |
|
string |
Table object owner. |
|
string |
View object owner. |
|
string |
Table object creation time. |
|
string |
View object creation time. |
|
integer |
Number of table object rows. |
|
integer |
Number of view object rows. |
|
integer |
Table object size. |
|
integer |
View object size. |
In field paths, [] denotes each item in an array. For example, items[].name is the name field of each item in the items array.
Error response¶
{
"code": 400,
"message": "name 不能为空"
}
| Field | Type | Description |
|---|---|---|
code | integer or string | Error code or status. |
message | string | Error message. |
Follow-up operations¶
Save the identification of the target item, and then query table information.