Trying to update DynamoDB item, what does this error mean? (I'm using Python/Boto3) [duplicate]
Solution 1:
You are only providing half of your primary key. Your primary key is a combination of the partition key and range key. You need to include the range key in your Key
attribute in the update parameters.
Solution 2:
For others who have faced the same challenge and the issue is not fixed by above answers, it is always better to double check the data type of the value being updated, in my case the primary key was expecting a Number and I was trying to update with a string. Silly me
Solution 3:
My checklist when facing this issue:
- Check that the name and type of your key correspond to what you have in the database.
- Use corresponding attributes to make it explicit. E.g. use
@DynamoDBHashKey(attributeName = "userId")
in Java to indicate the partition key nameduserId
. - Ensure that only one field or getter marked as partition key in your class.
Please, add more if you know in the comments.
Solution 4:
I was doing BatchGetItem
, then streamed it to BatchWriteItem
(Delete). DeleteItem
didn't like it got all attributes from the object instead of only partition and sort key.
Gathering all answers:
- mismatch in an attribute name
- mismatch in attribute type
- half key provided
- unnecessary additional keys