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

Feature: Inject all upstream nodes, and enable cross-project access checks #43

Merged
merged 4 commits into from
Apr 19, 2024

Conversation

nicholasyager
Copy link
Owner

Description and Motivation

A common feature request has been to see all upstream nodes from an injected project. For some time, this has not been available for a simple technical reason: dbt-core's access checks do not fire if you are not injecting dbt Labs' undocumented dependency structure at runtime. The consequence of this is that all access checks would break, allowing for private models to be ref-ed outside of groups if the referrer is in a different project. Unfortunately, dbt-core is designed in a purposefully obfuscated way to prevent mere mortals for leveraging this depenedency argument, so extra measures were required.

To that end, I've implemented some patches that allow us to wrap the existing reference access checks with injections that allow for dependency checks to occur as expected!

With this out of the way, we now have the following features:

  1. Cross-project DAGs include non-executing nodes (ModelArgNodes) for all upstream Models.
  2. Cross-project refs that reference non-public models fail with a Parsing Error as expected.
  3. I was able to remove some extra logic that was filtering down the DAG, so there will be a small performance boost.

Resolves: #40

Within dbt-core, the _way_ that dbt is invoked will determine if cross-project
references are considered dependencies at a project level. To keep this all simple,
I've implemented a basic monkeypatch that wraps the `is_invalid_protected_ref` and
`is_invalid_private_ref` methods of `Manifest` so that our injected projects are
evaluated as dependencies during access and group checks.
@nicholasyager nicholasyager added the enhancement New feature or request label Apr 14, 2024
@nicholasyager nicholasyager self-assigned this Apr 14, 2024
@nicholasyager nicholasyager merged commit ba9d8eb into main Apr 19, 2024
2 checks passed
@nicholasyager nicholasyager deleted the feature/include_all_models branch July 11, 2024 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable errors for Private and Protected nodes
1 participant