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

fix: Removing the certification key in case certification is null #215

Merged
merged 1 commit into from
Jun 5, 2023

Conversation

Vitor-Avila
Copy link
Contributor

This PR adds a few fixes/improvements to the dataset certification flow:

  • In case the certification is set to null via the dbt model definition, before we were setting certification: null in the dataset, which wouldn't show the certification pop up, but it would still include the dataset when filtering for certified: yes. With these changes, in case certification is set to null in the model definition, the certification key won't be included in the dataset's extra field.
  • Renamed the certification local variable to certification_info to better distinguish from the function argument. Also changed its content to a dictionary to only include the key pair in the extra definition in case it contains an actual value.
  • Updated the test for the new desired flow.

Comment on lines +89 to +95
certification_info = {
"certification": (
model_kwargs.get("extra", {}).pop("certification")
if "certification" in model_kwargs.get("extra", {})
else certification or {"details": "This table is produced by dbt"}
),
}
Copy link
Member

Choose a reason for hiding this comment

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

Just a nit, but sometimes it's cleaner to use a try/except:

try:
    certification_info = model_kwargs["extra"]["certification"]
except KeyError:
    certification_info = certification or DEFAULT_CERTIFICATION

(and we'd define DEFAULT_CERTIFICATION)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a very good feedback, @betodealmeida! I'm going to merge this PR for now to solve the issue in main, and address this in a future PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Handled this here: #221

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