Database Reference
In-Depth Information
The batchWriteItems API
The batchWriteItems API is a multiple purpose API that allows us to do things such
as adding multiple items to multiple tables, deleting item/s from multiple tables, or adding
an attribute to an existing item. Have a look at the following code:
$response = $client->batchWriteItem(array(
"RequestItems" => array(
"Book" => array(
array(
"PutRequest" => array(
"Item" => array(
"bookId" => array(Type::NUMBER =>
2020),
"name" => array(Type::STRING =>
"Mastering Cassandra")
)
)
)
),
"Author" => array(
array(
"PutRequest" => array(
"Item" => array(
"authId" => array(Type::NUMBER =>
5001),
"name" => array(Type::STRING =>
"Mark Brown"),
"country" => array(Type::STRING =>
"UK"),
"topics"=>array(Type::STRING_SET =>
array("Hadoop", "Cloud"))
))
),
array(
"DeleteRequest" => array(
"Key" => array(
"authId" => array(Type::NUMBER =>
5002)
Search WWH ::




Custom Search