I guess the following example will help.
assume this query:
$response = $client->batchWriteItem(array(
"RequestItems" => array(
"user" => array(
array(
"PutRequest" => array(
"Item" => array(
"userId" => array(Type::NUMBER => 7),
"attr1" => array(Type::NUMBER => 1),
"attr2" => array(Type::NUMBER => 2),
"attr3" => array(Type::NUMBER => 3),
)
),
)))));
This will create an Item with userId, attr1, attr2, attr3. Lets say you execute following batchWrite
$response = $client->batchWriteItem(array(
"RequestItems" => array(
"user" => array(
array(
"PutRequest" => array(
"Item" => array(
"userId" => array(Type::NUMBER => 7),
"temp1" => array(Type::NUMBER => 11),
"temp2" => array(Type::NUMBER => 22),
)
),
)))));
After this query is executed Item(row) would be userId, temp1, temp2 instead of userId,temp1,temp2,attr1,attr2,attr3.
So Technically they are right that we cannot use to update the item because it will create new item with same Hash Key replacing old Item(row).
so if you want to update the Item then we can use
$params['temp1'] = array(
'Action' => 'PUT',
'Value' => array(
Type::NUMBER => 555
)
);
}
$response = $client->updateItem(array(
"TableName" => "user",
"Key" => array(
"userId" => array(
Type::NUMBER => 7
)
),
"AttributeUpdates" => $params
)
);
This will update the item(row) and change value of temp1 from 1 to 555
Hope this will help