-
Notifications
You must be signed in to change notification settings - Fork 403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DynamoDBRecord throws decimal.Rounded for large numbers (over 38 digits) #4845
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
Hi @miikka I’ll look into this tomorrow. Thanks for reporting it. |
|
This is now released under 2.43.0 version! |
Expected Behaviour
When encountering a DynamoDB Streams event with a large number in the new/old image such as
{"N": "110111111111111110000000000000000000000"}
, Powertools' DynamoDB Streams data classes should be able to deserialize it like any other event. That is currently not the case if the number string is longer than 38 characters.According to DynamoDB docs, numbers may have up to 38 digits of precision. However, the trailing zeros do not count towards the precision and creating a document with the number above works fine.
(Note: if you try to create such document using AWS Console, the editor there blocks it unless you use the JSON view. The form editor seems to use a simpler check for the number validity.)
Current Behaviour
A
decimal.Rounded
exception gets thrown with a stacktrace like this when you try to accessrecord.dynamodb.new_image
when usingDynamoDBRecord
/DynamoDBStreamEvent
from DynamoDB Streams data classes to process a DynamoDB Streams events:Code snippet
Possible Solution
No response
Steps to Reproduce
record.dynamodb.new_image
for a record in the event.110111111111111110000000000000000000000
Powertools for AWS Lambda (Python) version
2.40.1
AWS Lambda function runtime
3.11
Packaging format used
Lambda Layers
Debugging logs
No response
The text was updated successfully, but these errors were encountered: