Skip to content

Instantly share code, notes, and snippets.

@PrzemekMalak
Created January 27, 2019 16:59
Show Gist options
  • Save PrzemekMalak/b96c58003435cbfa9e507b9e29057a78 to your computer and use it in GitHub Desktop.
Save PrzemekMalak/b96c58003435cbfa9e507b9e29057a78 to your computer and use it in GitHub Desktop.
dynamodb_encode_decode.py
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