Comments (1)
Thanks for opening @nicholasyager!
I agree that this is a bug. But I think it's slightly different from #8248, because generic tests can belong to groups
, and dbt automatically sets their group
attribute to match the model they're defined on.
The current intended behavior is:
- If a model is installed via a "package" dependency, and
restrict-access
isFalse
for that package, then it should be treated exactly the same as resources within this project. (This maintains historical behavior for packages.) - If a model is installed via a "package" dependency, and
restrict-access
isTrue
, then the difference in namespace (package_name
) should restrict private and protected references. - If a model is installed as a "project" dependency, then only reference to
public
models is allowed. To that end, theaccess
level and namespace (package_name
) are sufficient for resolving that reference, asgroups
don't currently exist across projects.
The current issue is that dbt's application of (2) is too broad, applying restrict-access
even to resources within the same package/group. Rather than changing this logic to skip private reference checks for tests, I think we need to change this logic to be something like the following:
def is_invalid_private_ref(
...
return is_private_ref and (
# Invalid reference because the group does not match
(hasattr(node, "group") and node.group and node.group != target_model.group)
# Or, invalid because these are different namespaces (project/package) and restrict-access is enforced
or (node.package_name != target_model.package_name and restrict_package_access)
)
When I try that change locally, and your reproduction case, dbt passes (and does not raise a DbtReferenceError
).
Speaking of groups across projects...
Feature: Support cross-project Group evaluation
It sounds like you might be thinking in a direction similar to this proposal:
The idea there is, a model should be ref'able by specific other projects, based on some opt-in criteria shared by both. If we pursue that idea, it would make sense to add group
(and whatever other necessary properties) to ModelNodeArgs
(which I see came up in linked conversation).
Open to hearing your thoughts on #9340!
from dbt-core.
Related Issues (20)
- [Regression] `dbt --quiet ls --output json` should not print warnings in 1.6 and 1.7 HOT 1
- [Bug] Restore v1.7 behavior for `--defer` + `--favor-state` when selecting interdependent resources
- [Bug] Unit tests fail when input contain reserved-word-named columns HOT 4
- support merge_update_columns logic for unit_tests HOT 2
- [Bug] Renaming or removing a contracted model should raise a BreakingChange warning/error HOT 2
- Make Memory Usage Reporting More Reliable
- [Bug] `data-tests` not found when executing in v1.8 HOT 1
- [Bug] TypeError: __post_serialize__() takes 2 positional arguments but 3 were given HOT 2
- [Epic] Multi-project collaboration: one year in HOT 1
- [Performance] 1.8 slower partial parsing than 1.7 HOT 3
- [Bug] Exposures can't reference private model HOT 1
- [Bug] dbtCore - after upgrading, can't run DBT HOT 26
- [Bug] saved queries are always selected as "modified", they should not be HOT 1
- [Bug] Macro adapter.get_columns_in_relation() doesn't return any columns during unit testing HOT 2
- Features that interacting with each other
- [Bug] Unit Test Failed When using quoted column in snowflake HOT 1
- [Bug] Pre- and post-hooks use parse phase values during the execution phase HOT 3
- [Epic] Snapshots as a First Class Citizen
- [Feature] `--empty` flag should be exposed in `flags` variable HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbt-core.