You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
The error you referenced (An error occurred (ValidationException) when calling the GetItem operation: The provided key element does not match the schema) suggests an issue with your schema. If you run the describe-table command it should look something like this:
And I can confirm that the command you shared works as expected:
Regarding the put_item command that you referenced, the documentation notes that the Bool value should be a boolean and not a string:
Describe the bug
I have a simple item I want to persist in dynamoDB that consists of numeric and boolean types.
When I reach
put_item
function it fails on validation.The problem is that the validation is not consistent. According to the documentation the attributes should be provided in this way:
aws dynamodb get-item \ --table-name ProductCatalog \ --key '{"Id":{"N":"1"}}'
when non-string values are also sent as strings. But when I do it I get error of invalid type.
Expected Behavior
Unified behavior according to the documentation
Current Behavior
If I try to
put_item
that looks like this - w/o wrapping numeric and boolean values in the double quotes:Then the error is:
But if instead I try to
put_item
that looks like - wrapping numeric and boolean values in the double quotes:Then I get
Reproduction Steps
Provided in current behavior
Possible Solution
No response
Additional Information/Context
No response
SDK version used
boto3 v.1.28.5
Environment details (OS name and version, etc.)
Mac Ventura 13.4.1
The text was updated successfully, but these errors were encountered: