本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
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參考。
描述
傳回資料表的相關資訊,包括資料表的目前狀態、主索引鍵結構描述,以及建立資料表的時間。 DescribeTable 結果最終一致。如果您在建立資料表的過程中使用 DescribeTable 過早,DynamoDB 會傳回 ResourceNotFoundException
。如果您在更新資料表的過程中使用 DescribeTable 過早,則可能無法立即使用新值。
請求
語法
// 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
|
要描述的資料表的名稱。 類型:字串 |
是 |
回應
語法
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 epoch 時間 |
ItemCount
|
指定資料表中的項目數。DynamoDB 大約每六個小時會更新一次此值。此值可能不會反映最近的變更。 類型:數字 |
KeySchema
|
資料表的主索引鍵 (簡單或複合) 結構。需要 HashKeyElement 的名稱值組,且可選用 RangeKeyElement 的名稱值組 (僅適用於複合主索引鍵)。雜湊索引鍵大小上限為 2048 個位元組。範圍索引鍵大小上限為 1024 個位元組。此兩項限制皆為分別執行 (意即可出現雜湊 + 範圍 2048 + 1024 位元的合併索引鍵)。如需主索引鍵的詳細資訊,請參閱 主索引鍵。 |
ProvisionedThroughput
|
指定資料表的輸送量,包含 LastIncreaseDateTime (如適用)、LastDecreaseDateTime (如適用)、ReadCapacityUnits 和 WriteCapacityUnits 的值。如果資料表輸送量從未增加或減少,則 DynamoDB 不會傳回這些元素的值。請參閱 DynamoDB 佈建容量模式。類型:陣列 |
TableName
|
所請求資料表的名稱。 類型:字串 |
TableSizeBytes
|
所指定資料表的總大小 (以位元組為單位)。DynamoDB 大約每六個小時會更新一次此值。此值可能不會反映最近的變更。 類型:數字 |
TableStatus
|
資料表目前的狀態 (CREATING 、ACTIVE 、DELETING 或 UPDATING )。一旦資料表處於 ACTIVE 狀態,您便可新增資料。 |
特殊錯誤
沒有此操作特定的錯誤。
範例
下列範例顯示使用名為 "comp-table" 之資料表的 DescribeTable操作的HTTPPOST請求和回應。資料表具有複合主索引鍵。
請求範例
// 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" } }