Skip to content
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

[CONTRIB] ExpectColumnValuesToBePresentInOtherTable - Interface Update #9165

Merged
merged 4 commits into from
Jan 2, 2024

Conversation

Shinnnyshinshin
Copy link
Contributor

@Shinnnyshinshin Shinnnyshinshin commented Dec 23, 2023

Update to interface after review

  • Keys to template_dict are now top-level parameters to Expectation.
res = validator.expect_column_values_to_be_present_in_another_table(
    foreign_key_column="CUSTOMER_ID",
    foreign_table="CUSTOMER_TABLE",
    primary_key_column_in_foreign_table="CUSTOMER_ID"
)
  • This required a minor change to Validator and ExpectationRegistry where we pass in the Expectation configuration whenever we load an expectation_implementation(). I believe this is very minor over-head for being able to enable this functionality, but I'd be happy to discuss.
  • Missing Values are now plotted using _diagnostic_unexpected_table_renderer, but only if the results actually have unexpected values.

Successful validation without table

Screenshot 2023-12-22 at 4 15 17 PM

Unsuccessful validation with table

Screenshot 2023-12-22 at 4 18 33 PM

  • Description of PR changes above includes a link to an existing GitHub issue
  • PR title is prefixed with one of: [BUGFIX], [FEATURE], [DOCS], [MAINTENANCE], [CONTRIB]
  • Code is linted - run invoke lint (uses black + ruff)
  • Appropriate tests and docs have been updated

For more information about contributing, see Contribute.

After you submit your PR, keep the page open and monitor the statuses of the various checks made by our continuous integration process at the bottom of the page. Please fix any issues that come up and reach out on Slack if you need help. Thanks for contributing!

Copy link

netlify bot commented Dec 23, 2023

Deploy Preview for niobium-lead-7998 ready!

Name Link
🔨 Latest commit 7719be8
🔍 Latest deploy log https://app.netlify.com/sites/niobium-lead-7998/deploys/6586233df9d16300083b2d82
😎 Deploy Preview https://deploy-preview-9165.docs.greatexpectations.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ghost
Copy link

ghost commented Dec 23, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@Shinnnyshinshin Shinnnyshinshin changed the base branch from develop to 0.18.x December 23, 2023 00:19
@Shinnnyshinshin Shinnnyshinshin self-assigned this Dec 23, 2023
Comment on lines -47 to -50
Also, the `template_dict` parameter we would use for the Expectation on `order_table_1` and `order_table_2` would
look like the following:

"template_dict" = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleaned this up since we no longer need to use template_dict

query = """
SELECT COUNT(1) FROM (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting enough, this was the only change that was needed to retrieve the full set of unexpected values

"out": {
"success": False,
"result": {
"observed_value": "2 missing valuess.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: typo in valuess

Copy link
Contributor

@JennyTee JennyTee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm; tks for the video demo

foreign_table: foreign table.
primary_key_column_in_foreign_table: key column for primary key in foreign table.
Args:
foreign_key_column: foreign key-column of current table that we want to validate.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: we prob don't need to hyphenate key-column here since it's not hyphenated on line 56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants