Feature request: support DynamoDB image values to dict with built-in Python types
See original GitHub issueUse case
When using DynamoDBRecord
class, the values for old_image
and new_image
are represented as Dict[str, AttributeValue]
. This representation is sufficient when the data parsed is simple and does not contain nested maps/lists.
But when the data parsed contains nested maps/lists, then it becomes hard to get to the data that AttributeValue
represents.
One would need to recursively parse the AttributeValue
objects in the nested dicts to get to the underlying data.
Solution/User Experience
Using a deserializer similar to the TypeDeserializer
provided by boto3 (link to code), one would be able to convert image to a Python dict where the values would be built-in Python types.
Alternative solutions
No response
Acknowledgment
- This feature request meets Lambda Powertools Tenets
- Should this be considered in other Lambda Powertools languages? i.e. Java, TypeScript
Issue Analytics
- State:
- Created a year ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Working with items and attributes - Amazon DynamoDB
The basic building blocks of Amazon DynamoDB start with tables, items, and attributes. ... An attribute value can be a scalar, a set,...
Read more >DynamoDB — Boto3 Docs 1.26.34 documentation - AWS
With DynamoDB, you can create database tables that can store and retrieve any amount of data, and serve any level of request traffic....
Read more >How to convert a boto3 Dynamo DB item to a regular ...
Yes It is a dict object but the types have to be made explicit. That's why I refer to it as a conversion....
Read more >Python Add to Dictionary – Adding an Item to a Dict
Data structures help us organize and store collections of data. Python has built-in data structures like Lists, Sets, ...
Read more >Amazon DynamoDB: What It Is and 10 Things You Should Know
Amazon DynamoDB is a managed NoSQL service with strong consistency and predictability, ... DynamoDB supports the following data types:.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Released in V2 now 😉 https://github.com/awslabs/aws-lambda-powertools-python/releases/tag/v2.0.0
That can be an option, but to my knowledge then one would not be able to do the following:
because you’d need the raw Python dictionary for
NewImage
andOldImage
to be able to useTypeDeserializer
, and the event won’t expose that.