I am looking at using DynamoDb for one of my applications.
I wanted to know if it's possible to set an attribute as range key and then leave it unpopulated for certain records(either empty or null).
You can't insert an item with Range Key as empty value or without the Range key.
If the Range key is not included. You would get the below error:-
"One of the required keys was not given a value"
If the Range key is populated with '' (i.e. empty string)
"message": "One or more parameter values were invalid: An AttributeValue may not contain an empty string"
From AWS Doc:-
When you add an item, the primary key attribute(s) are the only required attributes. Attribute values cannot be null. String and Binary type attributes must have lengths greater than zero. Set type attributes cannot be empty. Requests with empty values will be rejected with a ValidationException exception.
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