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 KeyError from defer + deletion #2958

Merged
merged 4 commits into from
Dec 17, 2020

Conversation

jtcohen6
Copy link
Contributor

@jtcohen6 jtcohen6 commented Dec 16, 2020

resolves #2875

Description

The fix for this is a lot simpler than I'd previously thought.

Because of --defer, it's possible that the --state manifest has recorded some upstream nodes (in depends_on) that no longer exist in the current project. When that upstream node is a source or ephemeral model, it raised a KeyError. The fix just required that, before we try to record an edge, we first check that the node being reported by the other manifest actually exists in our known set of project nodes.

I wrote out one test case, run_defer_deleted_upstream, which involved an upstream ephemeral model that exists in the deferral manifest but not in the current project. I confirmed that this test raises a KeyError without the one-line fix, and passes with it.

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt next" section.

@cla-bot cla-bot bot added the cla:yes label Dec 16, 2020
@jtcohen6 jtcohen6 force-pushed the fix/keyerror-defer-missing-parent branch from 281f763 to 2da3d21 Compare December 16, 2020 22:39
@jtcohen6 jtcohen6 marked this pull request as ready for review December 17, 2020 00:38
Copy link
Contributor

@kwigley kwigley left a comment

Choose a reason for hiding this comment

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

👏 nice test!

@jtcohen6 jtcohen6 merged commit 97ab130 into dev/kiyoshi-kuromiya Dec 17, 2020
@jtcohen6 jtcohen6 deleted the fix/keyerror-defer-missing-parent branch December 17, 2020 15:29
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.

KeyError while using deferred flag and model filters
3 participants