Created
January 27, 2019 16:59
-
-
Save PrzemekMalak/b96c58003435cbfa9e507b9e29057a78 to your computer and use it in GitHub Desktop.
dynamodb_encode_decode.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boto3.resource('dynamodb') | |
# Decode DynamoDB response to python | |
deserializer = boto3.dynamodb.types.TypeDeserializer() | |
data = {k: deserializer.deserialize(v) for k,v in low_level.items()} | |
# Encode python to DynamoDb low level format | |
serializer = boto3.dynamodb.types.TypeSerializer() | |
low_level = {k: serializer.serialize(v) for k,v in data.items()} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment