Is it possible to append to the list of values in a multi-valued attribute in an Amazon DynamoDB table? I am not quite able to figure it out using the put request. I would like to avoid the read, update, write logic if possible.
The only way to update multiple items at the same time is use TransactionWrite operation provided by DynamoDB. But it comes with a limitation (25 at most for example). So keep in mind with that, you probable should do some limitation in your application as well.
There is no limit to the number of attributes but the total item size is limited to 400kb. The maximum item size in DynamoDB is 400 KB, which includes both attribute name binary length (UTF-8 length) and attribute value lengths (again binary length).
DynamoDB transactional API operations have the following constraints: A transaction cannot contain more than 100 unique items. A transaction cannot contain more than 4 MB of data. No two actions in a transaction can work against the same item in the same table.
Using normal DynamoDB operations you're allowed to query either only one hash key per request (using GetItem or Query operations) or all hash keys at once (using the Scan operation).
Assuming you are referring to String and Number Sets as outlined in Amazon DynamoDB Data Types, this is possible in Amazon DynamoDB by means of the UpdateItem operation indeed:
ADD— Only use the add action for numbers or if the target attribute is a set (including string sets). ADD does not work if the target attribute is a single string value. The specified value is added to a numeric value (incrementing or decrementing the existing numeric value) or added as an additional value in a string set. If a set of values is specified, the values are added to the existing set. For example if the original set is [1,2] and supplied value is 3, then after the add operation the set is [1,2,3], not [4,5]. [...] [emphasis mine]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With