Skip to content

Conversation

@petemango
Copy link
Contributor

@petemango petemango commented Nov 28, 2025

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

@github-actions github-actions bot added the ingestion PR or Issue related to the ingestion of metadata label Nov 28, 2025
@petemango petemango changed the title feat: parametrized assertion run in python sdk feat(ingestion): parametrized assertion run in python sdk Nov 28, 2025
@datahub-cyborg datahub-cyborg bot added the needs-review Label for PRs that need review from a maintainer. label Nov 28, 2025
@codecov
Copy link

codecov bot commented Nov 28, 2025

Codecov Report

❌ Patch coverage is 25.00000% with 33 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ata-ingestion/src/datahub/api/graphql/assertion.py 25.00% 33 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link

Copilot AI left a 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.

Comment on lines +79 to +85
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
Copy link
Contributor

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

Suggested change
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
}
}"""

@datahub-cyborg datahub-cyborg bot added pending-submitter-response Issue/request has been reviewed but requires a response from the submitter and removed needs-review Label for PRs that need review from a maintainer. labels Nov 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ingestion PR or Issue related to the ingestion of metadata pending-submitter-response Issue/request has been reviewed but requires a response from the submitter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants