Table and view structure
Returns the columns, primary key, and indexes for the specified table or view.
POST /api/open/v1/metadata/getTable
Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| dataSourceId | Integer | Yes | DataSource ID. |
| namespacePath | Array of strings | Yes | Full path to the target namespace. See listNamespaces. |
| objectType | String | Yes | TABLE (table), VIEW (view). |
| tableName | String | Yes | Table or view name. |
Response fields
| Fields in data | Type | Description |
|---|---|---|
| tableName | String | Table or view name. |
| objectType | String | TABLE (table), VIEW (view). |
| columns | Array of objects | Column definitions. |
| columns[].name | String | Column name. |
| columns[].type | String | Database column type. |
| columns[].nullable | Boolean | Whether the column allows null values. |
| primaryKey | Array of strings | Names of the primary key columns. |
| indexes | Array of objects | List of indexes. |
| indexes[].name | String | Index name. |
| indexes[].unique | Boolean | Whether the index is unique. |
| indexes[].columns | Array of strings | Names of the indexed columns. |
Request example (PostgreSQL)
{
"dataSourceId": 43,
"namespacePath": ["sales", "public"],
"objectType": "TABLE",
"tableName": "orders"
}
Response example
{
"requestId": "a53d6ed5-2018-4c47-87b7-cc99c7369e5e",
"code": "OK",
"msg": "Request succeeded.",
"data": {
"tableName": "orders",
"objectType": "TABLE",
"columns": [
{"name": "id", "type": "bigint", "nullable": false},
{"name": "customer_id", "type": "bigint", "nullable": false}
],
"primaryKey": ["id"],
"indexes": [
{"name": "orders_customer_id_idx", "unique": false, "columns": ["customer_id"]}
]
}
}