本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
DescribeTables
This section refers to API version 2011-12-05,
which is deprecated and should not be used for new
applications.
有关当前低级别 API 的文档,请参阅 Amazon DynamoDB API Reference。
Description
返回有关表的信息,包括表的当前状态、主键架构以及表的创建时间。DescribeTable 结果具有最终一致性。如果您在创建表的早期使用 DescribeTable,DynamoDB
将返回 ResourceNotFoundException
。 如果您在更新表的早期使用 DescribeTable,新值可能不会立即可用。
Requests
Syntax
// This header is abbreviated. // For a sample of a complete header, see DynamoDB 低级 API. POST / HTTP/1.1 x-amz-target: DynamoDB_20111205.DescribeTable content-type: application/x-amz-json-1.0 {"TableName":"Table1"}
名称 | 描述 | 必需 |
---|---|---|
TableName
|
要描述的表的名称。 类型: 字符串 |
是 |
Responses
Syntax
HTTP/1.1 200 x-amzn-RequestId: 8966d095-71e9-11e0-a498-71d736f27375 content-type: application/x-amz-json-1.0 Content-Length: 543 {"Table": {"CreationDateTime":1.309988345372E9, ItemCount:1, "KeySchema": {"HashKeyElement":{"AttributeName":"AttributeName1","AttributeType":"S"}, "RangeKeyElement":{"AttributeName":"AttributeName2","AttributeType":"N"}}, "ProvisionedThroughput":{"LastIncreaseDateTime": Date, "LastDecreaseDateTime": Date, "ReadCapacityUnits":10,"WriteCapacityUnits":10}, "TableName":"Table1", "TableSizeBytes":1, "TableStatus":"ACTIVE" } }
名称 | 描述 |
---|---|
Table
|
描述表的容器。 类型: 字符串 |
CreationDateTime |
在 UNIX 纪元时间 |
ItemCount
|
指定表中的项目数。DynamoDB 大约每 6 小时更新一次该值。最近的更改可能不会反映在此值中。 类型: 数字 |
KeySchema
|
表的主键(简单或复合)结构。的名称-值对是必需的,HashKeyElement 的名称-值对是可选的(仅对于复合主键是必需的)。RangeKeyElement 最大哈希键大小为 2048 个字节。最大范围键大小为 1024 个字节。两个限制是分开实施的 (即,您可以组合使用哈希 + 范围 2048 + 1024 键)。有关主键的更多信息,请参阅主键。
|
ProvisionedThroughput
|
指定表的吞吐量,由 LastIncreaseDateTime (如果适用)、LastDecreaseDateTime (如果适用)、ReadCapacityUnits 和 WriteCapacityUnits 的值组成。 如果表的吞吐量从未增加或降低,则 DynamoDB 不会返回这些元素的值。请参阅 管理 DynamoDB 预置容量表的设置。
类型: 数组 |
TableName
|
所请求表的名称。 类型: 字符串 |
TableSizeBytes
|
指定表的总大小(以字节为单位)。DynamoDB 大约每 6 小时更新一次该值。最近的更改可能不会反映在此值中。 类型: 数字 |
TableStatus
|
表的当前状态(CREATING 、ACTIVE 、DELETING 或 UPDATING )。一旦表进入 ACTIVE 状态,您就可以添加数据。
|
特殊错误
没有特定于此操作的错误。
Examples
以下示例显示对名为“comp-table”的表使用 DescribeTable 操作的 HTTP POST 请求和响应。 表具有复合主键。
示例请求
// This header is abbreviated. // For a sample of a complete header, see DynamoDB 低级 API. POST / HTTP/1.1 x-amz-target: DynamoDB_20111205.DescribeTable content-type: application/x-amz-json-1.0 {"TableName":"users"}
示例响应
HTTP/1.1 200 x-amzn-RequestId: 8966d095-71e9-11e0-a498-71d736f27375 content-type: application/x-amz-json-1.0 content-length: 543 {"Table": {"CreationDateTime":1.309988345372E9, "ItemCount":23, "KeySchema": {"HashKeyElement":{"AttributeName":"user","AttributeType":"S"}, "RangeKeyElement":{"AttributeName":"time","AttributeType":"N"}}, "ProvisionedThroughput":{"LastIncreaseDateTime": 1.309988345384E9, "ReadCapacityUnits":10,"WriteCapacityUnits":10}, "TableName":"users", "TableSizeBytes":949, "TableStatus":"ACTIVE" } }