分页获取表的描述信息 - ListTableMeta
功能介绍
通过数据库通配符和表通配符,找到符合条件的表并返回表的描述信息。
调试
您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。
授权信息
账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限,具体权限要求请参见权限和授权项。
URI
GET /v1/{project_id}/instances/{instance_id}/catalogs/{catalog_name}/databases/tables
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| project_id | 是 | String | 项目编号。获取方法,请参见获取项目ID。 |
| instance_id | 是 | String | LakeFormation实例ID。创建实例时自动生成。例如:2180518f-42b8-4947-b20b-adfc53981a25。 |
| catalog_name | 是 | String | catalog名称。只能包含字母、数字和下划线,且长度为1~256个字符。 |
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| database_name_pattern | 否 | String | 数据库名称通配符。只能包含中文、字母、数字和_|*.-特殊字符,且长度为1~128个字符。 |
| table_name_pattern | 否 | String | 表名称通配符。只能包含中文、字母、数字和_|*.-特殊字符,且最大长度为1~256个字符。 |
| table_types | 否 | Array of strings | 查询的表类型:MANAGED_TABLE-内表、EXTERNAL_TABLE-外表、VIRTUAL_VIEW-视图、MATERIALIZED_VIEW-物化视图、DICTIONARY_TABLE字典表、LAKE_TABLE内表。 |
| limit | 否 | Integer | 查询返回条数。默认值为1000。最小值为1,最大值为2000。 |
| marker | 否 | String | 查询的起始记录ID。最小长度为0,最大长度为256。 |
| reverse_page | 否 | Boolean | 是否倒序查询。 |
| external_table_id | 否 | String | 用户端表id,创建时指定,不可修改。 |
请求参数
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| X-Auth-Token | 是 | Array of strings | 租户token。 |
响应参数
状态码:200
| 参数 | 参数类型 | 描述 |
|---|---|---|
| table_metas | Array of TableMeta objects | 表元数据列表。 |
| page_info | PagedInfo object | 分页返回信息。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| catalog_name | String | catalog名称。 |
| database_name | String | 数据库名称。 |
| table_name | String | 表名称。 |
| external_table_id | String | 用户端表id,创建时指定,不可修改。 |
| table_type | String | 表类型:MANAGED_TABLE-内表、EXTERNAL_TABLE-外表、VIRTUAL_VIEW-视图、MATERIALIZED_VIEW-物化视图、DICTIONARY_TABLE字典表,LAKE_TABLE内表。 |
| comments | String | 表描述信息。 |
| columns | Array of Column objects | 分区列以外的所有字段。 |
| partition_keys | Array of Column objects | 分区列的信息。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| column_type | String | 列类型,包括array bigint binary boolean char date decimal double float int interval map set smallint string struct timestamp tinyint union varchar |
| column_name | String | 列名称。只能包含中文、字母、数字和_-+*(), 特殊字符,且长度为1~767个字符。 |
| comment | String | 列描述信息。最大长度为4000个字符。 |
| advance_column_type | String | 用户自定义类型名称,当且仅当column_type为struct,字段可填写。该字段存在值时,表示用户自定义的高阶类型。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| current_count | Integer | 本次返回的对象个数。最小值为0,最大值为2000。 |
| next_marker | String | 下一页查询地址。当不存在下一页,则值为null,当值为null时,响应Body无该参数。 |
| previous_marker | String | 上一页查询地址。当不存在上一页,则值为null,当值为null时,响应Body无该参数。 |
状态码:400
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 错误码。 |
| error_msg | String | 错误描述。 |
| solution_msg | String | 解决方案描述。 |
状态码:401
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 错误码。 |
| error_msg | String | 错误描述。 |
| solution_msg | String | 解决方案描述。 |
状态码:403
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error | Error object | 错误信息。 |
| error_code | String | 错误码。 |
| error_msg | String | 错误描述。 |
| title | String | 标题。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 错误码。 |
| error_msg | String | 错误描述。 |
| title | String | 标题。 |
| message | String | 错误信息。 |
| code | String | 状态码。 |
状态码:404
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 错误码。 |
| error_msg | String | 错误描述。 |
| solution_msg | String | 解决方案描述。 |
状态码:408
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 错误码。 |
| error_msg | String | 错误描述。 |
| solution_msg | String | 解决方案描述。 |
状态码:500
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 错误码。 |
| error_msg | String | 错误描述。 |
| solution_msg | String | 解决方案描述。 |
请求示例
GET https://{endpoint} /v1/{project_id}/instances/{instance_id}/catalogs/{catalog_name}/databases/tables 响应示例
状态码:200
OK
{
"table_metas" : [ {
"catalog_name" : "hive",
"database_name" : "default",
"table_name" : "tbla",
"table_type" : "MANAGED_TABLE",
"comments" : ""
}, {
"catalog_name" : "hive",
"database_name" : "default",
"table_name" : "tblb",
"table_type" : "MANAGED_TABLE",
"comments" : ""
} ],
"page_info" : {
"current_count" : 2,
"next_marker" : null,
"previous_marker" : null
}
} 状态码:400
Bad Request
{
"error_code" : "common.01000001",
"error_msg" : "failed to read http request, please check your input, code: 400, reason: Type mismatch., cause: TypeMismatchException"
} 状态码:401
Unauthorized
{
"error_code" : "APIG.1002",
"error_msg" : "Incorrect token or token resolution failed"
} 状态码:403
Forbidden
{
"error" : {
"code" : "403",
"message" : "X-Auth-Token is invalid in the request",
"error_code" : null,
"error_msg" : null,
"title" : "Forbidden"
},
"error_code" : "403",
"error_msg" : "X-Auth-Token is invalid in the request",
"title" : "Forbidden"
} 状态码:404
Not Found
{
"error_code" : "common.01000001",
"error_msg" : "response status exception, code: 404"
} 状态码:408
Request Timeout
{
"error_code" : "common.00000408",
"error_msg" : "timeout exception occurred"
} 状态码:500
Internal Server Error
{
"error_code" : "common.00000500",
"error_msg" : "internal error"
} 状态码
| 状态码 | 描述 |
|---|---|
| 200 | OK |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 408 | Request Timeout |
| 500 | Internal Server Error |
错误码
请参见错误码。