Skip to content

Commit

Permalink
fix: Numbers such as 1e100 cannot be retrieved from DynamoDB (#4916)
Browse files Browse the repository at this point in the history
  • Loading branch information
khvn26 authored Dec 11, 2024
1 parent 6cd6cb8 commit 5d02ab1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/environments/dynamodb/wrappers/base.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import typing
from decimal import Context
from functools import partial

import boto3
import boto3.dynamodb.types
from botocore.config import Config

if typing.TYPE_CHECKING:
from mypy_boto3_dynamodb.service_resource import Table


# Avoid `decimal.Rounded` when reading large numbers
# See https://github.com/boto/boto3/issues/2500
boto3.dynamodb.types.DYNAMODB_CONTEXT = Context(prec=100)


class BaseDynamoWrapper:
table_name: str = None

Expand Down

0 comments on commit 5d02ab1

Please sign in to comment.