選取您的 Cookie 偏好設定

我們使用提供自身網站和服務所需的基本 Cookie 和類似工具。我們使用效能 Cookie 收集匿名統計資料,以便了解客戶如何使用我們的網站並進行改進。基本 Cookie 無法停用,但可以按一下「自訂」或「拒絕」以拒絕效能 Cookie。

如果您同意,AWS 與經核准的第三方也會使用 Cookie 提供實用的網站功能、記住您的偏好設定,並顯示相關內容,包括相關廣告。若要接受或拒絕所有非必要 Cookie,請按一下「接受」或「拒絕」。若要進行更詳細的選擇,請按一下「自訂」。

DynamoDB 的 Amazon S3 匯入格式

焦點模式
DynamoDB 的 Amazon S3 匯入格式 - Amazon DynamoDB

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

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

DynamoDB 可以匯入三種格式的資料:CSV、DynamoDB JSON和 Amazon Ion。

CSV

格式的檔案CSV由以新行分隔的多個項目組成。根據預設,DynamoDB 會將匯入檔案的第一行解讀為標頭,並預期欄會以逗號分隔。只要標頭符合檔案中的欄數,您也可以定義欲套用的標頭。如果標頭定義明確,檔案的第一行將會匯入為值。

注意

從CSV檔案匯入時,除 雜湊範圍和基礎資料表和次要索引索引以外的所有資料欄都會匯入為 DynamoDB 字串。

轉義雙逸出

CSV 檔案中存在的任何雙引號字元都必須逸出。如果未經逸出 (如下列範例),則匯入將失敗:

id,value "123",Women's Full Lenth Dress

如果使用兩組雙引號逸出,則相同的匯入將成功:

id,value """123""",Women's Full Lenth Dress

文字正確逸出並匯入後,就會如原始CSV檔案所示:

id,value "123",Women's Full Lenth Dress

DynamoDB JSON

DynamoDB JSON 格式的檔案可以包含多個項目物件。每個個別物件都是 DynamoDB 的標準調度JSON格式,而新行會用作項目分隔符號。新增功能中,預設支援從時間點的匯出可作為匯入來源。

注意

新行會用作 DynamoDB JSON 格式檔案的項目分隔符號,不應在項目物件內使用。

[{ "Item": { "Authors": { "SS": ["Author1", "Author2"] }, "Dimensions": { "S": "8.5 x 11.0 x 1.5" }, "ISBN": { "S": "333-3333333333" }, "Id": { "N": "103" }, "InPublication": { "BOOL": false }, "PageCount": { "N": "600" }, "Price": { "N": "2000" }, "ProductCategory": { "S": "Book" }, "Title": { "S": "Book 103 Title" } } }]
注意

新行會用作 DynamoDB JSON 格式檔案的項目分隔符號,不應在項目物件內使用。

[{ "Item": { "Authors": { "SS": ["Author1", "Author2"] }, "Dimensions": { "S": "8.5 x 11.0 x 1.5" }, "ISBN": { "S": "333-3333333333" }, "Id": { "N": "103" }, "InPublication": { "BOOL": false }, "PageCount": { "N": "600" }, "Price": { "N": "2000" }, "ProductCategory": { "S": "Book" }, "Title": { "S": "Book 103 Title" } } },{ "Item": { "Authors": { "SS": ["Author1", "Author2"] }, "Dimensions": { "S": "8.5 x 11.0 x 1.5" }, "ISBN": { "S": "444-444444444" }, "Id": { "N": "104" }, "InPublication": { "BOOL": false }, "PageCount": { "N": "600" }, "Price": { "N": "2000" }, "ProductCategory": { "S": "Book" }, "Title": { "S": "Book 104 Title" } } },{ "Item": { "Authors": { "SS": ["Author1", "Author2"] }, "Dimensions": { "S": "8.5 x 11.0 x 1.5" }, "ISBN": { "S": "555-5555555555" }, "Id": { "N": "105" }, "InPublication": { "BOOL": false }, "PageCount": { "N": "600" }, "Price": { "N": "2000" }, "ProductCategory": { "S": "Book" }, "Title": { "S": "Book 105 Title" } } }]

Amazon Ion

Amazon Ion 是輸入豐富、自行描述、階層資料序列化格式,旨在處理快速開發、解耦及日常遇到的效率挑戰等問題,同時設計以服務為導向的大規模架構。

將資料匯入為 Ion 格式時,DynamoDB 資料表中使用的 DynamoDB 資料類型會映射至 Ion 資料類型。

S. 編號 Ion 至 DynamoDB 資料類型轉換 B

1

Ion Data Type

DynamoDB Representation

2

string

String (s)

3

bool

Boolean (BOOL)

4

decimal

Number (N)

5

blob

Binary (B)

6

list (with type annotation $dynamodb_SS, $dynamodb_NS, or $dynamodb_BS)

Set (SS, NS, BS)

7

list

List

8

struct

Map

Ion 檔案中的項目以新行分隔。每行都以 Ion 版本標記開頭,後面接著 Ion 格式的項目。

注意

在下列範例中,我們在多行上格式化了來自 Ion 格式檔案的項目,以提高可讀性。

$ion_1_0 [ { Item:{ Authors:$dynamodb_SS::["Author1","Author2"], Dimensions:"8.5 x 11.0 x 1.5", ISBN:"333-3333333333", Id:103., InPublication:false, PageCount:6d2, Price:2d3, ProductCategory:"Book", Title:"Book 103 Title" } }, { Item:{ Authors:$dynamodb_SS::["Author1","Author2"], Dimensions:"8.5 x 11.0 x 1.5", ISBN:"444-4444444444", Id:104., InPublication:false, PageCount:6d2, Price:2d3, ProductCategory:"Book", Title:"Book 104 Title" } }, { Item:{ Authors:$dynamodb_SS::["Author1","Author2"], Dimensions:"8.5 x 11.0 x 1.5", ISBN:"555-5555555555", Id:105., InPublication:false, PageCount:6d2, Price:2d3, ProductCategory:"Book", Title:"Book 105 Title" } } ]

下一個主題:

限制與配額

上一個主題:

匯入資料表
隱私權網站條款Cookie 偏好設定
© 2025, Amazon Web Services, Inc.或其附屬公司。保留所有權利。