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

[CT-643] Support package resources with path: selector method #5243

Closed
jtcohen6 opened this issue May 13, 2022 · 7 comments
Closed

[CT-643] Support package resources with path: selector method #5243

jtcohen6 opened this issue May 13, 2022 · 7 comments
Labels
enhancement New feature or request Impact: Exp node selection Functionality and syntax for selecting DAG nodes stale Issues that have gone stale

Comments

@jtcohen6
Copy link
Contributor

jtcohen6 commented May 13, 2022

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.

if Path(real_node.root_path) != root:
continue

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 select fct_direct_join_to_source.

Acceptance criteria

  • dbt ls -s full/relative/path/to/package/model.sql should return that model

Suggested tests

def test_select_file(manifest):

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.

  1. Start returning package resources based on their original_file_path (always relative), and expect services passing file names into dbt list to trim off dbt_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 also models/my_model.sql, even if they're defined in different packages. I think that's fair, and in keeping with expected behavior.

  2. Add a new FileIDSelector. dbt-core does have a notion of an internal "file ID" that looks like package_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 sure dbt deps takes care of this. (It should be the same for Hub packages, based on how dbt deps renames the package after installation, but not necessarily the same for non-Hub packages.)

@jtcohen6 jtcohen6 added enhancement New feature or request node selection Functionality and syntax for selecting DAG nodes Team:Execution labels May 13, 2022
@github-actions github-actions bot changed the title Support package resources with path: selector method [CT-643] Support package resources with path: selector method May 13, 2022
@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot added the stale Issues that have gone stale label Dec 20, 2022
@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 28, 2022
@racheldaniel
Copy link
Contributor

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.

@jtcohen6 jtcohen6 reopened this Apr 8, 2024
@jtcohen6 jtcohen6 added Impact: Exp and removed stale Issues that have gone stale labels Apr 8, 2024
@ChenyuLInx
Copy link
Contributor

We might need to insert dbt packages in the original_file_path

@ChenyuLInx
Copy link
Contributor

Whoever picks this one up please pair with @gshank

Copy link
Contributor

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.

@github-actions github-actions bot added the stale Issues that have gone stale label Nov 11, 2024
Copy link
Contributor

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.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Impact: Exp node selection Functionality and syntax for selecting DAG nodes stale Issues that have gone stale
Projects
None yet
Development

No branches or pull requests

4 participants