Skip to content

What's the usage or advantages on using aws_lambda_powertools.utilities.parser parse? #5670

Discussion options

You must be logged in to vote

Hi @jerry118118! Glad to hear you're considering using Powertools!

In this use case you're right, there's not much difference between using parser and validating it directly against the Pydantic model, both work basically the same way. We try to optimize the experience by caching the model and not trying to load it into memory all the time, but this is useful if you have thousands of validations, which doesn't seem to be your case.

Another use case we help customers with using the Parser utility is the ability to fail fast by using the event_parser function and decorating your Lambda handler. In this case if the event doesn’t match the Model it will fail before executing the Lambda handle…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jerry118118
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants