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-2665] [Regression] For the list command the path selector does not respect the --project-dir param #7819

Closed
2 tasks done
rudeb0y opened this issue Jun 7, 2023 · 6 comments · Fixed by #7829
Closed
2 tasks done
Assignees
Labels
bug Something isn't working Medium Severity bug with minor impact that does not have resolution timeframe requirement regression
Milestone

Comments

@rudeb0y
Copy link

rudeb0y commented Jun 7, 2023

Is this a regression in a recent version of dbt-core?

  • I believe this is a regression in dbt-core functionality
  • I have searched the existing issues, and I could not find an existing issue for this regression

Current Behavior

in dbt 1.5.1, the path selector does not seem to work with --project-dir.

that is, given a directory structure:

  • dbt_projects
    • project1
    • project2

from the dbt_projects root, the following works in 1.4.6 but not 1.5.1.

Expected/Previous Behavior

I expect the path selector to work as in the previous versions of dbt.

Steps To Reproduce

  1. in a dbt-core==1.5.1 environement..
  2. with a root/<dbt_projects> structure
  3. from root, try to dbt ls -s path:path/to/models/dir/ --project-dir <one of the dbt_sub_projects>
  4. it will find no nodes.

repeat this for dbt-core==1.4.6 which will find the expected nodes

Relevant log output

No response

Environment

- OS: macOS
- Python: 3.11.1
- dbt (working version): 1.4.6
- dbt (regression version): 1.5.1

Which database adapter are you using with dbt?

snowflake

Additional Context

No response

@rudeb0y rudeb0y added bug Something isn't working regression triage labels Jun 7, 2023
@github-actions github-actions bot changed the title [Regression] The path selector no-longer works outside of the dbt-project, it does not respect the --project-dir param [CT-2665] [Regression] The path selector no-longer works outside of the dbt-project, it does not respect the --project-dir param Jun 7, 2023
@rudeb0y rudeb0y closed this as completed Jun 7, 2023
@rudeb0y
Copy link
Author

rudeb0y commented Jun 7, 2023

re-read the upgrade docs and closed as I thought I'd missed something, however this did not work either:

dbt ls --project-dir=snowflake/snowflake_dbt -s path:models/marts/finance

So I think this might be legit

@rudeb0y rudeb0y reopened this Jun 7, 2023
@dbeatty10
Copy link
Contributor

Thanks for reporting this @rudeb0y.

This is legit, and I was able to reproduce it as you described 👍

It's possible this is similar to #7465 (but unique).

Reprex

Tree structure:

dbt_projects
└── project1
    ├── dbt_project.yml
    └── models
        └── my_model.sql

dbt_projects/project1/models/my_model.sql

select 1 as id

This works with dbt 1.4:

$ dbt ls --project-dir dbt_projects/project1 -s path:models

my_project.my_model

But not 1.5:

$ dbt ls --project-dir dbt_projects/project1 -s path:models

02:19:46  Running with dbt=1.5.0
02:19:47  Found 1 model, 0 tests, 0 snapshots, 0 analyses, 307 macros, 0 operations, 0 seed files, 0 sources, 0 exposures, 0 metrics, 0 groups
02:19:47  The selection criterion 'path:models' does not match any nodes
02:19:47  No nodes selected!

@radium226
Copy link

radium226 commented Aug 14, 2023

Hello! I think this issue should be reopened: it does not work anymore with dbt 1.5.4 and dbt 1.6.0.

@jtcohen6
Copy link
Contributor

@radium226 Thanks for following up! From what I can tell, this was fixed in v1.5.2, but it stopped working again in v1.5.3 (and also 1.5.4 + 1.6.0).

$ dbt ls -s path:models/my_model.sql --project-dir my_dbt_project/
13:29:52  Running with dbt=1.5.2
...
my_dbt_project.my_model

$ dbt ls -s path:models/my_model.sql --project-dir my_dbt_project/
13:30:05  Running with dbt=1.5.3
...
13:30:05  No nodes selected!

I know we made a change to how the context var is being saved (#7949), in order to resolve an issue for users of SQLFluff (#7937). It sounds like the fix to this issue was also undone, however.

@jtcohen6 jtcohen6 reopened this Aug 14, 2023
@gshank
Copy link
Contributor

gshank commented Aug 14, 2023

This happened because setting the contextvar was moved to a contextmanager on the runnable run method. The list command doesn't inherit from that, so it needs it's own contextmanager.

@gshank gshank changed the title [CT-2665] [Regression] The path selector no-longer works outside of the dbt-project, it does not respect the --project-dir param [CT-2665] [Regression] For the list command the path selector does not respect the --project-dir param Aug 14, 2023
@jtcohen6
Copy link
Contributor

Closing in favor of more specific issue:

@martynydbt martynydbt added the Medium Severity bug with minor impact that does not have resolution timeframe requirement label Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Medium Severity bug with minor impact that does not have resolution timeframe requirement regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants