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 issue where sources nodes with tags were excluded from graph viz #139

Merged
merged 4 commits into from
Sep 28, 2020

Conversation

jplynch77
Copy link
Contributor

@jplynch77 jplynch77 commented Sep 25, 2020

resolves #93

Description

This resolves an issue where source nodes with tags were not showing up in the graph visualization. The root problem seems to be that tags from sources are not added to all_tags in main/index.js. This causes selectNodes() in selector_methods.js to exclude sources with tags. Specifically, a source node with a tag ends up hitting the (!matched_tags && !matched_untagged) condition in

        if (!matched_package || (!matched_tags && !matched_untagged) || !matched_types) {
            nodes_to_prune.push(node.data.unique_id);
        }

This change also makes tags defined only on sources available in tags drop-down in the graph viz.

Checklist

  • I have signed the CLA
  • I have generated docs locally, and this change appears to resolve the stated issue
  • I have updated the CHANGELOG.md and added information about my change to the "dbt next" section.

@cla-bot
Copy link

cla-bot bot commented Sep 25, 2020

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: John Lynch.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https:/settings/emails

2 similar comments
@cla-bot
Copy link

cla-bot bot commented Sep 25, 2020

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: John Lynch.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https:/settings/emails

@cla-bot
Copy link

cla-bot bot commented Sep 25, 2020

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: John Lynch.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https:/settings/emails

@drewbanin drewbanin self-requested a review September 25, 2020 17:42
@drewbanin
Copy link
Contributor

Really nice catch @jplynch77!! I think this logic is pretty funky. My bet is that this logic came from the fact that test nodes in dbt are automatically tagged with either schema or data depending on what kind of test they are, and we wanted to exclude these from the tag selector. I suppose we could also implement:

if (model.resource_type != 'test') 

but I don't feel super strongly about that. I wonder if tagged snapshots or seeds would show up with this current implementation. Maybe we can test that out and decide what the right implementation is? Either way, I think you found exactly the right line of code to modify!

Let me know if you need a hand with the CLA-bot thing. You might just need to rebase your earlier commits to make sure that every commit is signed as your user.

@jplynch77
Copy link
Contributor Author

Thanks for the review @drewbanin ! That's a good point about capturing tags from other resource_types. I'll test that out.

And thanks for the tip on rebasing - that seemed to do the trick.

@jplynch77
Copy link
Contributor Author

@drewbanin did some testing and if (model.resource_type != 'test') does indeed catch tags defined on seeds/snapshots, so this seems strictly better to me!

Copy link
Contributor

@drewbanin drewbanin left a comment

Choose a reason for hiding this comment

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

This LGTM! Thanks for the PR on this one @jplynch77 🎉

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

Successfully merging this pull request may close these issues.

Tags break sources in the lineage view
2 participants