Skip to main content

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​

ParameterTypeRequiredDescription
dataSourceIdIntegerYesDataSource ID.
namespacePathArray of stringsYesFull path to the target namespace. See listNamespaces.
objectTypeStringYesTABLE (table), VIEW (view).
tableNameStringYesTable or view name.

Response fields​

Fields in dataTypeDescription
tableNameStringTable or view name.
objectTypeStringTABLE (table), VIEW (view).
columnsArray of objectsColumn definitions.
columns[].nameStringColumn name.
columns[].typeStringDatabase column type.
columns[].nullableBooleanWhether the column allows null values.
primaryKeyArray of stringsNames of the primary key columns.
indexesArray of objectsList of indexes.
indexes[].nameStringIndex name.
indexes[].uniqueBooleanWhether the index is unique.
indexes[].columnsArray of stringsNames 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"]}
]
}
}