-
Notifications
You must be signed in to change notification settings - Fork 421
feat(idempotent): Add support for jmespath_options #302
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
feat(idempotent): Add support for jmespath_options #302
Conversation
Like for the validator, idempotent utility should allow for extracting an idempotent key using custom functions
Codecov Report
@@ Coverage Diff @@
## develop #302 +/- ##
===========================================
- Coverage 99.71% 99.68% -0.04%
===========================================
Files 87 87
Lines 3151 3155 +4
Branches 150 151 +1
===========================================
+ Hits 3142 3145 +3
Misses 5 5
- Partials 4 5 +1
Continue to review full report at Codecov.
|
@cakepietoast @heitorlessa i can update the docs, if this feature makes sense? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after docs mention this -- In all fairness, simply copy and replace what's available in Validations doc, and we can refactor that to make it reusable later.
aws_lambda_powertools/utilities/idempotency/persistence/base.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last change and I'll merge it :)
Here's the inner cache of jmespath parser - used both by compile and search: https://github.com/jmespath/jmespath.py/blob/599b0f7ea650a60f7512233301e70ff8151de0f0/jmespath/parser.py#L84
Here's the subtle difference between compile and search: https://github.com/jmespath/jmespath.py/blob/599b0f7ea650a60f7512233301e70ff8151de0f0/jmespath/__init__.py#L23
Contrary to fastjsonschema that doesn't cache, JMESPath does on both occasions, and keep up to 128 expressions.
Thanks Michael, again! I'm merging as-is, and create a reminder to come back to simplify the internals once I have a better understanding of Tom's implementation. |
Issue #, if available:
Description of changes:
Like for the validator, idempotent utility should allow for extracting an idempotent key using custom functions
Example usage:
We have an api gateway proxy event:
Where event is:
And
c299229
is the idempotent key we want to use:Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.