Merge pull request #2869 from JessFlan/master
DynamodBStreams get_records gets JSON errors when processing complex types
This commit is contained in:
commit
452e63977e
@ -7,7 +7,7 @@ import base64
|
|||||||
from boto3 import Session
|
from boto3 import Session
|
||||||
|
|
||||||
from moto.core import BaseBackend, BaseModel
|
from moto.core import BaseBackend, BaseModel
|
||||||
from moto.dynamodb2.models import dynamodb_backends
|
from moto.dynamodb2.models import dynamodb_backends, DynamoJsonEncoder
|
||||||
|
|
||||||
|
|
||||||
class ShardIterator(BaseModel):
|
class ShardIterator(BaseModel):
|
||||||
@ -137,7 +137,7 @@ class DynamoDBStreamsBackend(BaseBackend):
|
|||||||
|
|
||||||
def get_records(self, iterator_arn, limit):
|
def get_records(self, iterator_arn, limit):
|
||||||
shard_iterator = self.shard_iterators[iterator_arn]
|
shard_iterator = self.shard_iterators[iterator_arn]
|
||||||
return json.dumps(shard_iterator.get(limit))
|
return json.dumps(shard_iterator.get(limit), cls=DynamoJsonEncoder)
|
||||||
|
|
||||||
|
|
||||||
dynamodbstreams_backends = {}
|
dynamodbstreams_backends = {}
|
||||||
|
@ -134,6 +134,7 @@ class TestCore:
|
|||||||
"id": {"S": "entry1"},
|
"id": {"S": "entry1"},
|
||||||
"first_col": {"S": "bar"},
|
"first_col": {"S": "bar"},
|
||||||
"second_col": {"S": "baz"},
|
"second_col": {"S": "baz"},
|
||||||
|
"a": {"L": [{"M": {"b": {"S": "bar1"}}}]},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
conn.delete_item(TableName="test-streams", Key={"id": {"S": "entry1"}})
|
conn.delete_item(TableName="test-streams", Key={"id": {"S": "entry1"}})
|
||||||
|
Loading…
Reference in New Issue
Block a user