

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# DescribeTables
<a name="API_DescribeTables_v20111205"></a>

**重要**  
***本節涉及不該再用於新應用程式的已棄用 API 版本 2011-12-05。***  
 **如需目前低階 API 的文件，請參閱[Amazon DynamoDB API 參考](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/)。**

## 描述
<a name="API_DescribeTables_Description"></a>

傳回資料表相關資訊，包括資料表目前狀態、主索引鍵結構描述以及建立資料表的時間。DescribeTable 結果為最終一致性。如果在建立資料表過程中太早使用 DescribeTable，DynamoDB 會傳回 `ResourceNotFoundException`。如果在更新資料表過程中太早使用 DescribeTable，新值可能無法立即使用。

## 請求
<a name="API_DescribeTables_RequestParameters"></a>

### 語法
<a name="API_DescribeTables_RequestParameters.syntax"></a>

```
// 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  |  要描述的資料表的名稱。 類型：字串   |  是  | 

## 回應
<a name="API_DescribeTables_ResponseElements"></a>

### 語法
<a name="API_DescribeTables_ResponseElements.syntax"></a>

```
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 格式](http://www.epochconverter.com/)日期。 | 
|  ItemCount  |  指定資料表中的項目數。DynamoDB 大約每六個小時會更新一次此值。此值可能不會反映最近的變更。 類型：數字  | 
|  KeySchema  | 資料表的主索引鍵 (簡單或複合) 結構。需要 HashKeyElement 的名稱值組，且可選用 RangeKeyElement 的名稱值組 (僅適用於複合主索引鍵)。雜湊索引鍵大小上限為 2048 個位元組。範圍索引鍵大小上限為 1024 個位元組。此兩項限制皆為分別執行 (意即可出現雜湊 \$1 範圍 2048 \$1 1024 位元的合併索引鍵)。如需主索引鍵的詳細資訊，請參閱 [主索引鍵](HowItWorks.CoreComponents.md#HowItWorks.CoreComponents.PrimaryKey)。 | 
| ProvisionedThroughput  | 指定資料表的輸送量，包含 LastIncreaseDateTime (如適用)、LastDecreaseDateTime (如適用)、ReadCapacityUnits 和 WriteCapacityUnits 的值。如果資料表輸送量從未增加或減少，則 DynamoDB 不會傳回這些元素的值。請參閱 [DynamoDB 佈建容量模式](provisioned-capacity-mode.md)。類型：陣列  | 
|  TableName  |  所請求資料表的名稱。 類型：字串  | 
|  TableSizeBytes  |  所指定資料表的總大小 (以位元組為單位)。DynamoDB 大約每六個小時會更新一次此值。此值可能不會反映最近的變更。 類型：數字  | 
|  TableStatus  | 資料表目前的狀態 (CREATING、ACTIVE、DELETING 或 UPDATING)。一旦資料表處於 ACTIVE 狀態，您便可新增資料。 | 

## 特殊錯誤
<a name="API_DescribeTables_SpecialErrors"></a>

沒有此操作特定的錯誤。

## 範例
<a name="API_DescribeTables_Examples"></a>

 下列範例會顯示對名為 comp-table 的資料表使用 DescribeTable 操作的 HTTP POST 請求和回應。資料表具有複合主索引鍵。

### 請求範例
<a name="API_DescribeTables_Examples_Request"></a>

```
// 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"}
```

### 回應範例
<a name="API_DescribeTables_Examples_Response"></a>

```
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"
    }
}
```

## 相關動作
<a name="API_DescribeTables_Related_Actions"></a>
+  [CreateTable](API_CreateTable_v20111205.md) 
+  [DeleteTable](API_DeleteTable_v20111205.md) 
+  [ListTables](API_ListTables_v20111205.md) 