Open lamalex opened 3 months ago
Thanks for reaching out @lamalex !
I wasn't able to trigger any error after some quick attempts with dbt commands plus a tag:
selector with the dbt CLI.
My guess is that somehow this scenario is prevented from happening when using the dbt CLI, but it is somehow possible when using Dagster.
Regardless, it looks like it could be prevented here by doing something similar to here.
i.e., replace if hasattr(node, "tags")
with if hasattr(node, "tags") and node.tags
.
This is how I fixed it locally, the only reason I didn’t open a PR was that I wasn’t sure if this was the right place for the fix, or if it was a bug in manifest generation. This works!
Hi @dbeatty10 is there anything more needed to merge this for the next release? I’m running a fork in prod rn 😬
is there anything more needed to merge this for the next release? I’m running a fork in prod rn 😬
https://github.com/dbt-labs/dbt-core/pull/10520 is in code review. If it gets approved, then it will go into dbt-core v1.9 this fall. It hasn't been decided yet if it would be back-ported into v.1.8.x.
What would need to be true to backport?
What would need to be true to backport?
Fixes for regressions and net-new bugs that were present in the minor version's original release will be backported to releases with active support. Other bug fixes will be backported when we have high confidence that they're narrowly scoped and won't cause unintended side effects.
The "tags" field in UnitTestDefinition UnitTestConfig should never be None, and I don't think it is in dbt. It is not an Optional field and so should never be None. How does it get to be None in Dagster?
@gshank it’s not on the config object- it’s on the root. The config object DOES have tags, but that’s not what’s being iterated here (i think!)
It's coming directly from the config object for the case of UnitTestDefinitions, via a "def tags" property on the node. So this would happen if the UnitTestConfig is constructed improperly with tags set to None. The definition of "tags" on UnitTestConfig does not include Optional and we don't set it to None in our code anywhere.
Is this a new bug in dbt-core?
Current Behavior
I'm only able to reproduce this with Dagster/Dagster dbt - i haven't been able to work the cli to reproduce, here's the relevant section of code from the dagster dbt library (https://github.com/dagster-io/dagster/blob/278e49048ba961070a7caaf161ee30a01a31ee84/python_modules/libraries/dagster-dbt/dagster_dbt/utils.py#L19):
I've stepped through the code in the debugger and am fairly sure this is a DBT bug and not a Dagster bug.
in
if the node is a
unit_test
node, it'stags
attr isNone
, which causes the iteration to explode. In my manifest there is notags
attribute on the top level of theunit_test
node (like in other node types),tags
only exists onconfig
.Expected Behavior
dbt can successfully iterate over node types without a type error
Steps To Reproduce
Set up a dagster dbt project with unit tests and use a
tag:...
selectorfor instance
Relevant log output
Environment
Which database adapter are you using with dbt?
redshift, other (mention it in "Additional Context")
Additional Context
databricks