Database Reference
In-Depth Information
BatchWriteItem
If we need to write data to multiple tables at the same time, then the
BatchWriteItem
operation is advised whenever and wherever possible, because it distributes the write
throughput equally across all the tables. The following request tries to write two items into
Tbl_Library
and one item into
Tbl_Book
. It is also possible to send
De-
leteRequest
in place of
PutRequest
simultaneously for a table. Have a look at the
following table:
{
"RequestItems": {
"Tbl_Library": [
{
"PutRequest": {
"Item": {
"Name":{"S":"Harvard University Library"},
"Country":{"S":"United States"},
"City":{"S":"Massachusetts"} } } },
{
"PutRequest": {
"Item": {
"Name":{"S":"Vernadsky National Library"},
"Country":{"S":"Ukraine"},
"City":{"S":"Kiev"} } } }]
"Tbl_Book": [
{
"PutRequest": {
"Item": {
"BookTitle": { "S": "SCJP" },
"Author": { "S": "Brendon" },
"Language":{ "SS": ["English"] },
"Edition": { "N": "5" } }} } ]},
"ReturnConsumedCapacity": "TOTAL"
}
The response to the previous
BatchWriteItem
request is shown as follows: