The table has two keys: filename
(partition key) and eventTime
(sort key).
I want to update eventTime
for certain filename
. Tried put_item()
and update_item()
sending the same filename
with new eventTime
but those functions add a new item instead of update.
What should I use for that purpose?
You can't. Since it is part of the index, the field is protected. What you should do it to delete the item and add it again with the new sort key.
See https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_AttributeValueUpdate.html
According to DynamoDB/AttributeValueUpdate
aws docs:
You cannot use
UpdateItem
to update any primary key attributes. Instead, you will need to delete the item, and then usePutItem
to create a new item with new attributes.
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