-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[CT-643] Support package resources with path:
selector method
#5243
Comments
path:
selector methodpath:
selector method
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days. |
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers. |
The XP team is watching this as a possible solution for issues with compile/preview not working on dbt packages in the IDE. Per slack thread with core this is to be reopened. |
We might need to insert dbt packages in the |
Whoever picks this one up please pair with @gshank |
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days. |
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers. |
Prompts:
Short description
The dbt Cloud IDE uses
dbt list
behind the scenes to power the DAG viz. When it provides+dbt_packages/package_name/models/.../model_name.sql+
,dbt-core
doesn't return any resources.The reason: dbt-core's
path:
selector method doesn't support resources defined in packages.dbt-core/core/dbt/graph/selector_methods.py
Lines 288 to 289 in 72c17c4
Proposed resolution
Update
FileSelectorMethod
to accept the full relative path of resources defined in packages, including the install path and the package name, as a way to select that resource.For example,
dbt_packages/dbt_project_evaluator/models/marts/dag/fct_direct_join_to_source.sql
to selectfct_direct_join_to_source
.Acceptance criteria
dbt ls -s full/relative/path/to/package/model.sql
should return that modelSuggested tests
dbt-core/tests/unit/test_graph_selector_methods.py
Line 1150 in e81f7fd
https://github.com/dbt-labs/dbt-core/blob/main/tests/functional/list/test_list.py
Alternatives
Both of these alternatives (the original resolutions I suggested in ~2022) would require additional logic on the "client" side. I believe a preferable resolution allows clients to pass the full (relative) path to all resources, both those defined in the root project and those defined in packages, without any additional logic.
Start returning package resources based on their
original_file_path
(always relative), and expect services passing file names intodbt list
to trim offdbt_packages/package_name/
. Because models with the same name can be defined in multiple installed packages, this could return multiple models that have the same relative path. For example, if I alsomodels/my_model.sql
, even if they're defined in different packages. I think that's fair, and in keeping with expected behavior.Add a new
FileIDSelector
.dbt-core
does have a notion of an internal "file ID" that looks likepackage_name://relative/file/path
, which it uses to uniquely identify each file during partial parsing. That still requires knowing the name of the package, though. I'm pretty suredbt deps
takes care of this. (It should be the same for Hub packages, based on howdbt deps
renames the package after installation, but not necessarily the same for non-Hub packages.)The text was updated successfully, but these errors were encountered: