更新时间:2024-06-20 GMT+08:00
分享

查询表

功能介绍

指定仓查询表属性,如容量,规模,配额。

URI

POST /v1/describe-table

表1 Query参数

参数

是否必选

参数类型

描述

store_name

String

仓名,全域唯一,不同租户的仓名不能相同。

  • 格式:${prefix}-${region-code}-${account-id},其中prefix为自定义前缀,region-code为kvs集群所在的区域代码,account-id为用户的账户id

  • 取值字符限制:[a-z0-9-]+

  • 长度:[16,52]

说明:

"-"不能出现在名字头部或尾部

请求参数

表2 请求Body参数

参数

是否必选

参数类型

描述

table_name

String

表名。

  • 长度:[3, 63]

  • 取值字符限制:[a-zA-Z0-9_-]+

响应参数

状态码: 200

表3 响应Body参数

参数

参数类型

描述

table_name

String

表名。

  • 长度:[3, 63]

  • 取值字符限制:[a-z0-9_-]+

primary_key_schema

primary_key_schema object

主键模板, 最多1个,必须指定主键schema。

local_secondary_index_schema

Array of secondary_index objects

本地二级索引模板,可以多个。

global_secondary_index_schema

Array of global_secondary_index objects

全局二级索引模板。

run_time_info

run_time_info object

运行信息。

表4 primary_key_schema

参数

参数类型

描述

shard_key_fields

Array of field objects

分区键字段名数组,顺序组合。

shard_mode

String

分区模式。

sort_key_fields

Array of field objects

排序键字段名数组,顺序组合。

表5 secondary_index

参数

参数类型

描述

index_name

String

二级索引名称,表内唯一。

sort_key_fields

Array of field objects

排序键字段名数组,顺序组合。

abstract_fields

Array of strings

摘要字段名数组。

表6 global_secondary_index

参数

参数类型

描述

index_name

String

二级索引名称,表内唯一。

shard_key_fields

Array of field objects

分区键字段名数组,顺序组合。

shard_mode

String

分区模式。

sort_key_fields

Array of field objects

排序键字段名数组,顺序组合。

abstract_fields

Array of strings

摘要字段名数组。

表7 field

参数

参数类型

描述

name

String

字段名。

order

Boolean

bool值预留无意义。

表8 run_time_info

参数

参数类型

描述

table_info

table_info object

表信息。

local_secondary_index_infos

Array of secondary_index_info objects

索引状态。

global_secondary_index_infos

Array of global_secondary_index_info objects

全局二级索引运行态。

表9 table_info

参数

参数类型

描述

table_status

String

表状态。

  • "creating"

  • "active"

  • "deleting"

表10 secondary_index_info

参数

参数类型

描述

index_name

String

索引状态。

  • 长度:[1, 255]

  • 取值字符限制:[a-z0-9_-]+

index_status

String

索引状态。

  • "creating"

  • "active"

  • "deleting"

表11 global_secondary_index_info

参数

参数类型

描述

index_name

String

二级索引名称。

index_status

String

二级索引名称。

  • "creating"

  • "active"

  • "deleting"

状态码: 400

表12 响应Body参数

参数

参数类型

描述

error_code

String

请求返回的错误码。

error_msg

String

请求返回的错误信息。

请求示例

查询表名为test-table的表信息

POST https://{endpoint}/v1/describe-table

{
  "table_name" : "test-table"
}

响应示例

状态码: 200

表示查询表请求成功

{
  "table_name" : "test_table_1",
  "primary_key_schema" : {
    "shard_key_fields" : [ {
      "name" : "owner",
      "order" : true
    } ],
    "sort_key_fields" : [ {
      "name" : "filename",
      "order" : true
    } ]
  },
  "runtime_info" : {
    "table_info" : {
      "table_status" : "ACTIVE"
    }
  }
}

状态码

状态码

描述

200

表示查询表请求成功

400

BadRequest

错误码

请参见错误码

相关文档