Get Column List
Query columns by table name.
Endpoint: /openapi/v1/metadata/column/list
Method: GET
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
datasourceId | String | Yes | Data source ID. Call Retrieve Data Source List to get the value. | ds-d92qvqp8o1fw |
databaseName | String | Yes | Database name. Call Get Database List to get the value. | 9zcloud |
schemaName | String | No | Schema name. Call Get Schema List to get the value. | public |
tableName | String | Yes | Table name. Call Get Table List to get the value. | pgbench_accounts |
Response parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
success | Bool | Whether the call succeeded. Values: true or false. | true |
requestId | String | Request ID. | Ax8w2SHX-DJGGjUVnEJLj1YCdGFq2ZEZ |
data | Array | Column list. Items may include columnName, columnComment, dataType, length, scale, unsigned, nullable, charsetName, collationName, ordinalPosition, and columnDefault. | {"columnName":"id","dataType":"bigint"} |
Column details
Each column object in data may contain the following fields.
| Parameter | Type | Description | Example |
|---|---|---|---|
columnName | String | Column name. | id |
columnComment | String | Column comment. | Primary key |
dataType | String | Column data type, such as varchar. | bigint |
length | Long | Column length. | 20 |
scale | Long | Data precision. For floating-point and Numeric types, this is the length of the fractional part. | 0 |
unsigned | Boolean | Whether the column is unsigned. | false |
nullable | Boolean | Whether the column accepts null. | true |
charsetName | String | Character set. | utf8mb4 |
collationName | String | Collation. | utf8mb4_general_ci |
ordinalPosition | Integer | Column position. | 1 |
columnDefault | String | Column default value. | null |
Successful response
{
"success": true,
"requestId": "Ax8w2SHX-DJGGjUVnEJLj1YCdGFq2ZEZ",
"data": [
{
"columnName": "id",
"dataType": "bigint",
"length": 64,
"scale": 0,
"unsigned": false,
"nullable": true,
"ordinalPosition": 0
}
]
}