-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Regression] Deprecation date check raises KeyError in dbt-core & dbt Cloud #10911
Comments
I'm not familiar enough with the internals of dbt-core testing, but I feel like the tests should include more sophisticated/"real-world" examples of production-like dbt projects. For example, versioned models with deprecation dates. |
Thank you for reporting this @danlsn ! I was able to reproduce this using the latest code in the ReprexCreate these files:
select 1 as id
models:
- name: my_model
deprecation_date: 1999-01-01 00:00:00.00+00:00
exposures:
- name: my_exposure
type: analysis
owner: {email: [email protected]}
depends_on:
- ref("my_model") Run these commands: dbt parse --no-partial-parse Get these error logs:
|
@danlsn I confirmed that when I used your code suggestion, that the error went away: diff --git a/core/dbt/parser/manifest.py b/core/dbt/parser/manifest.py
index 493b562bb..d5fbef59a 100644
--- a/core/dbt/parser/manifest.py
+++ b/core/dbt/parser/manifest.py
@@ -590,7 +590,7 @@ class ManifestLoader:
# Get the child_nodes and check for deprecations.
child_nodes = self.manifest.child_map[node.unique_id]
for child_unique_id in child_nodes:
- child_node = self.manifest.nodes[child_unique_id]
+ child_node = self.manifest.nodes.get(child_unique_id)
if not isinstance(child_node, ModelNode):
continue
if node.is_past_deprecation_date: |
Is this a new bug in dbt-core?
Current Behavior
dbt-core is failing to parse a project where a versioned model, with a deprecation date defined, is depended on by an exposure.
Inside the
ManifestLoader
class, thecheck_for_model_deprecations(self)
method is raising aKeyError
when checking child nodes.dbt-core/core/dbt/parser/manifest.py
Lines 592 to 593 in bdb79e8
As you can see from the error the code is using the fqn for an exposure to search the
self.manifest.nodes
dictionary, which it would never find.Potential Fix
A simple solution would be to try and find the
child_node
inself.manifest.nodes
using the.get()
method instead. In this case when looking for an exposure in nodes, it will returnNone
and continue at theisinstance()
guard clause.Expected Behavior
Steps To Reproduce
Relevant log output
Environment
Which database adapter are you using with dbt?
snowflake
Additional Context
The text was updated successfully, but these errors were encountered: