<span id="读取数据库表视图树"></span>

# Read the database, table, and view tree

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

`POST /meta/db/tree` selects a workspace through exactly one nonempty X-Workspace-ID. The handler does not read the body and has no business pagination, search, or database-selection parameters. An empty body or {} is allowed. Database pagination parameters do not take effect here.

<span id="请求参数"></span>

## Request parameters

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```text
POST https://api.moi.matrixorigin.cn/v5/meta/db/tree
```

:::::
:::::{tab-item} Parameters

No business request body is read. No pagination, search, or database-selection parameters. Exactly one nonempty `X-Workspace-ID` selects the workspace.

:::::
::::::
:::::::

<span id="成功响应"></span>

## Successful response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Fields

Success uses numeric code=200 and data.db_list. The service lists databases in the current caller's session, then runs SHOW FULL TABLES per database to distinguish tables/views. This is not an atomic catalog snapshot. Failure reading any database may fail the whole request.

| Field | Type | Current mapping |
| --- | --- | --- |
| data.db_list | array or null | May be null when there are no databases; not a paginated result. |
| db_list[].db_name | string | Database name. |
| db_list[].display_name | string | Optional in the DTO but unset by the current tree conversion. Its absence does not establish that Catalog display names are unsupported. |
| db_list[].is_internal | boolean | Current internal metadata marker. |
| db_list[].is_subscription | boolean | Unset by the current conversion and outputs false; insufficient to determine actual subscription status. |
| db_list[].has_published | boolean | Also a zero value from the current mapping, not a publication-state probe. |
| db_list[].tables / views | object | Each group has tables and total; the list inside views is also named tables. |
| groups.tables | array or null | Table/view entries described below. |
| groups.total | integer | Number returned in that group. |
| entries.name | string | Name from SHOW FULL TABLES. |
| entries.owner / created | string | Empty string in the current conversion. |
| entries.rows / size | integer | The current tree conversion collects no statistics. Zero values do not mean an actually empty table or zero bytes. |

groups/entries in field paths are table shorthand. An actual path is data.db_list[].views.tables[].name. db_owner in SDK models does not guarantee this handler returns it. Errors use SQL numeric code/message envelopes; identity/generic errors may use string code/msg.

:::::
::::::
:::::::
