-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(ingestion): parametrized assertion run in python sdk #15447
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Pull request overview
This PR adds the ability to run parameterized SQL assertions via the Python SDK by introducing three new methods to the Assertion class in the GraphQL API module.
- Added support for running single and multiple assertions with runtime parameters
- Introduced GraphQL mutations and fragments for assertion execution
- Added helper method to convert Python dictionaries to GraphQL StringMapEntry format
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
Co-authored-by: Copilot <[email protected]>
| RUN_ASSERTION_MUTATION: str = """ | ||
| %s | ||
| mutation runAssertion($urn: String!, $saveResult: Boolean, $parameters: [StringMapEntryInput!], $async: Boolean) { | ||
| runAssertion(urn: $urn, saveResult: $saveResult, parameters: $parameters, async: $async) { | ||
| ... assertionResult | ||
| } | ||
| }""" % ASSERTION_RESULT_FRAGMENT |
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.
minor style comment; I just find this pattern more readable
| RUN_ASSERTION_MUTATION: str = """ | |
| %s | |
| mutation runAssertion($urn: String!, $saveResult: Boolean, $parameters: [StringMapEntryInput!], $async: Boolean) { | |
| runAssertion(urn: $urn, saveResult: $saveResult, parameters: $parameters, async: $async) { | |
| ... assertionResult | |
| } | |
| }""" % ASSERTION_RESULT_FRAGMENT | |
| RUN_ASSERTION_MUTATION: str = f""" | |
| ${ASSERTION_RESULT_FRAGMENT} | |
| mutation runAssertion($urn: String!, $saveResult: Boolean, $parameters: [StringMapEntryInput!], $async: Boolean) { | |
| runAssertion(urn: $urn, saveResult: $saveResult, parameters: $parameters, async: $async) { | |
| ... assertionResult | |
| } | |
| }""" |
In a previous pr, we introduced the ability to substitute template variables in SQL assertions at run time, the feature was only available via our graphql interface, this pr aims to bring the ability to run parameterized SQL assertions via the Python SDK