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

Display all model compatibility errors at once #11

Merged
merged 1 commit into from
Feb 26, 2021

Conversation

vitorbaptista
Copy link
Contributor

If there are multiple incompatibilities between the dbt docs and
Metabase, displaying them all at once makes it much easier to fix. This
allows the user to fix all errors at once, instead of fixing one,
running dbt-metabase, fixing the next one, and so on.

If there are multiple incompatibilities between the dbt docs and
Metabase, displaying them all at once makes it much easier to fix. This
allows the user to fix all errors at once, instead of fixing one,
running `dbt-metabase`, fixing the next one, and so on.
Copy link
Owner

@gouline gouline left a comment

Choose a reason for hiding this comment

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

Small logic change. Thanks for your contribution!

if column_name not in table_lookup:
logging.warn("Column %s not found in model %s", column_name, model_name)
return False
are_models_compatible = False
Copy link
Owner

Choose a reason for hiding this comment

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

Once this becomes false, it never goes back to true so just return False in both instances and then return True at the end. The only change here is the else branch (which I'm happy with).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My intent on this PR was to display all errors in all models and fields, so the user could fix all errors at once instead of fixing one error, running dbt-metabase, fixing another error, running it again, and so on. This helped a lot when running dbt-metabase for the first time -- it was a great way to find discrepancies between my dbt docs and the tables in the DB.

If I removed these are_models_compatible changes and just kept the else branch in this PR, the code's behaviour would be the same as it is now.

Copy link
Owner

Choose a reason for hiding this comment

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

Ah, of course, you're doing it for the logs. Makes sense.

@gouline gouline merged commit 3c8ebff into gouline:master Feb 26, 2021
@vitorbaptista vitorbaptista deleted the display-all-errors branch March 2, 2021 20:59
@vitorbaptista
Copy link
Contributor Author

Thanks for merging and releasing a new version so quickly (and, of course, the project itself -- it's super useful!)

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