> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memorylake.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 列出字段

> 列出数据源中某张数据表的字段，以及它们的注释和索引设置

```
GET /openapi/memorylake/api/v3/workspaces/{workspaceId}/db-datasources/{datasourceId}/columns
```

列出这个数据源所覆盖 schema 中某张数据表的字段，以及每个字段的注释和是否为其值建立语义匹配索引。一次响应即返回完整列表。表名可以通过[列出数据表](https://docs.memorylake.cn/features/memorylake/api-reference/database/datasources/list-tables.md)查到。如果传入的表名不在这个数据源的覆盖范围内，返回空列表。

如需修改字段的注释或索引开关，请调用[编辑 Schema 元数据](https://docs.memorylake.cn/features/memorylake/api-reference/database/datasources/edit-schema-metadata.md)。

> [!NOTE]
>
> **所需权限：** `db_datasource:read`

### 路径参数

**workspaceId** `string` *required*

工作空间 ID

**datasourceId** `string` *required*

数据源 ID

### 查询参数

**table\_name** `string` *required*

要列出字段的数据表名

```bash cURL theme={null}
curl -X GET 'https://app.memorylake.cn/openapi/memorylake/api/v3/workspaces/ws-8001856949ad4f6a5b6226f415ffa877/db-datasources/dbds-4b8e2f6a1c9d4e7b8a3f5c2d6e9b1a7c/columns?table_name=orders' \
  -H 'Authorization: Bearer sk_xxxxxx'
```

### 响应

**data** `object`

**字段列表**

**items** `array`

字段对象数组

**字段对象**

**comment** `string`

描述这个字段内容的注释。未设置时为空。

**schema\_name** `string`

字段所属的 schema

**table\_name** `string`

字段所属的数据表

**column\_name** `string`

字段名

**data\_type** `string`

数据库报告的字段类型，例如 `bigint` 或 `varchar`

**embedding\_enabled** `boolean`

是否为这个字段的值建立语义匹配索引

**max\_embedding\_rows** `integer`

这个字段最多有多少个值会进入索引。无法通过 API 修改。

```json Success (200) theme={null}
{
  "success": true,
  "data": {
    "items": [
      {
        "comment": "Order identifier",
        "schema_name": "sales",
        "table_name": "orders",
        "column_name": "order_id",
        "data_type": "bigint",
        "embedding_enabled": false,
        "max_embedding_rows": 1000
      },
      {
        "comment": "Customer who placed the order",
        "schema_name": "sales",
        "table_name": "orders",
        "column_name": "customer_id",
        "data_type": "bigint",
        "embedding_enabled": false,
        "max_embedding_rows": 1000
      },
      {
        "comment": "Order total, including tax",
        "schema_name": "sales",
        "table_name": "orders",
        "column_name": "total_amount",
        "data_type": "numeric",
        "embedding_enabled": false,
        "max_embedding_rows": 1000
      },
      {
        "comment": "",
        "schema_name": "sales",
        "table_name": "orders",
        "column_name": "created_at",
        "data_type": "timestamp",
        "embedding_enabled": false,
        "max_embedding_rows": 1000
      }
    ]
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.