อัปเดตครั้งล่าสุดเมื่อ
21 ธ.ค. 2021
Description
This function inserts or removes one or more items into one or multiple tables.
For more information, see BatchWriteItem.
Category
History
ColdFusion (2021 release): Added this function.
Syntax
serviceHandle.batchWriteItem(requestParameters)
Parameters
See the request parameters of BatchWriteItem.
Example
<cfscript> cred = { "credentialAlias" : "myalias", "vendorName" : "AWS", "region" : "us-east-2", "secretAccessKey" : "xxxxx", "accessKeyId" : "xxxx" } conf={ "serviceName"="DYNAMODB" } dynamo=getCloudService(cred, conf) tableName="batchWriteMovie" // put multiple items in table batchWriteItemStruct={ "RequestItems":{ "#tableName#":[ { "PutRequest":{ "Item":{ "year": {"N": 2018}, "title": {"S": "Solo"} } } }, { "PutRequest":{ "Item":{ "year":{"N":2018}, "title":{"S":"Aquaman"} } } }, { "PutRequest":{ "Item":{ "year":{"N":2018}, "title":{"S":"Hereditary"} } } } ] } } try{ batchWriteItemResponse=dynamo.batchWriteItem(batchWriteItemStruct,{"hasType":true}) writeOutput("Write item operation successful") writeDump(batchWriteItemResponse) } catch(any e){ writeDump(e) } </cfscript>
Output