Open nicholasyager opened 11 months ago
@nicholasyager Thanks for opening! :)
It does feel a bit weird that macros can reference private models, if called from within other models in the same group, but not if the same macro is called via run-operation
.
I'm inclined to say that we should support this, same as how we added support for compilation/preview of --inline
queries that reference private models:
I'll queue this up for the next milestone of multi-project work. If the fix is quite simple (and I think it is, right where you're pointing to!) we could backport for inclusion in a v1.6.x patch.
Notes from refinement:
Hi team. Any update on when this might be updated/fixed?
The label says backport 1.7 but 1.8 is out now.
@b-per I've just created a new epic for multi-project work over the next few months, and I'm including this on there. I see this lower priority than other bugs / QoL improvements that have been coming up more often, but definitely open to hearing that I should be prioritizing it more highly.
At this point, I'd be inclined to "roll forward" with this fix, and include it in the subsequent minor version.
I don't think this would be a very big lift, so I'd say it's also fair game for community contribution (by you or someone else) :)
Yes, my comment about seeing the backport 1.7 label was more whether it was still an issue considered for the future. I agree that it doesn't look critical enough to backport it to previous versions.
Should we add the community label then?
And I'll check the new epic! 👀
Is this a new bug in dbt-core?
Current Behavior
Suppose you have a model (
order.sql
) setup in a group (example
) with access set to private. If you execute a macro thatref
s this private model, dbt will abort with anAttributeError: 'Macro' object has no attribute 'group'
exception.This issue seems to originate in the
resolve
method inRuntimeRefResolver
. Specifically, this chunk of logic:When running a macro via run-operation,
target_model
is not aParsedNode
, but rather aMacro
, which do not have a concept of agroup
. Hence, theAttributeError
.Expected Behavior
Given that macros are not part of the group and access abstraction, I would expect macros executed within a
run-operation
context to be able to ref any model in a dbt project without verifying group membership.Steps To Reproduce
run-operation
.Relevant log output
Environment
Which database adapter are you using with dbt?
snowflake
Additional Context
No response