-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: support DynamoDB image values to dict with built-in Python types #1432
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
Thanks a lot for taking the time to raise it Ahmed. I can’t wait to see
this PR.
…On Sun, 7 Aug 2022 at 20:20, boring-cyborg[bot] ***@***.***> wrote:
Thanks for opening your first issue here! We'll come back to you as soon
as we can.
—
Reply to this email directly, view it on GitHub
<#1432 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZPQBFDAIJWNCR57BOXDSTVX75ARANCNFSM5523LQSA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***
com>
|
@shanab It seems like the data classes features is trying to implement parsing features IMO. |
@ran-isenberg the problem in our case was that the service was not using Pydantic, and we did not want to introduce it only to parse the DynamoDB record. |
hey @shanab Ahmed, checking in to see if you still have the bandwidth to contribute as you already had the code working. Thank you! |
@heitorlessa yes, I should have time this week to have a first draft. Sorry for leaving this open until now! |
What about using boto3's TypeDeserializer ? |
That can be an option, but to my knowledge then one would not be able to do the following: @event_source(data_class=DynamoDBStreamEvent)
def lambda_handler(event: DynamoDBStreamEvent, context):
pass because you'd need the raw Python dictionary for |
Released in V2 now ;) https://github.com/awslabs/aws-lambda-powertools-python/releases/tag/v2.0.0 |
|
Use case
When using
DynamoDBRecord
class, the values forold_image
andnew_image
are represented asDict[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
The text was updated successfully, but these errors were encountered: