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-2688] [Regression] Can no longer target analysis in a selection #7849

Closed
2 tasks done
moltar opened this issue Jun 13, 2023 · 7 comments
Closed
2 tasks done

[CT-2688] [Regression] Can no longer target analysis in a selection #7849

moltar opened this issue Jun 13, 2023 · 7 comments
Labels
bug Something isn't working regression

Comments

@moltar
Copy link

moltar commented Jun 13, 2023

Is this a new bug in dbt-core?

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

Current Behavior

This no longer works in 1.5.1:

dbt compile --select "analysis/"

However, if I run without the --select:

dbt compile

The analysis are found and are compiled.

Expected Behavior

To support the selection of analysis as a path.

Steps To Reproduce

Run:

dbt compile --select "analysis/"

Observe that target/*/analysis is empty.

Relevant log output

N/A

Environment

- OS: macOS
- Python: 3.11
- dbt: 1.5.1

Which database adapter are you using with dbt?

postgres

Additional Context

This selection method worked from at least 1.3.0 to 1.4.6.

@moltar moltar added bug Something isn't working triage labels Jun 13, 2023
@github-actions github-actions bot changed the title [Bug] Can no longer target analysis in a selection [CT-2688] [Bug] Can no longer target analysis in a selection Jun 13, 2023
@jtcohen6
Copy link
Contributor

jtcohen6 commented Jun 13, 2023

@moltar I'm not able to reproduce this locally:

# dbt_project.yml
name: ...
profile: ...
analysis-paths: ["analysis"]
-- analysis/my_analysis.sql
-- {{ run_started_at }}
select 1 as id
$ dbt compile -s "analysis/"
14:04:10  Running with dbt=1.5.1
14:04:10  Found 1 model, 0 tests, 0 snapshots, 1 analysis, 307 macros, 0 operations, 0 seed files, 0 sources, 0 exposures, 0 metrics, 1 group
14:04:10
14:04:11  Concurrency: 5 threads (target='dev')
14:04:11
-- target/compiled/my_dbt_project/analysis/my_analysis.sql
-- 2023-06-13 14:04:10.765988+00:00
select 1 as id

@gshank
Copy link
Contributor

gshank commented Jun 13, 2023

Were you using a project_dir that's not the root directory of your project? This might be another example of #7819.

@moltar
Copy link
Author

moltar commented Jun 13, 2023

Were you using a project_dir that's not the root directory of your project?

Yes!! 😁

export DBT_PROJECT_DIR="sub/dir/dbt"
export DBT_PROFILES_DIR="$DBT_PROJECT_DIR"

dbt compile --select "analysis/"

@dbeatty10
Copy link
Contributor

@moltar I re-created a dbt project with environment variables similar to #7819, and all of the following worked for me when using dbt~=1.5.0 if I removed the trailing slash:

dbt compile --select analysis

and

dbt compile --select analysis --project-dir $DBT_PROJECT_DIR

and

dbt compile --select analysis --project-dir $DBT_PROJECT_DIR --profiles-dir $DBT_PROFILES_DIR

But using a trailing slash didn't work for me in dbt v1.4 or v1.5 🤷 (Using double quotes or not didn't affect my results.)

Could you give it a shot without the trailing slash and see if it works or not?

@dbeatty10 dbeatty10 changed the title [CT-2688] [Bug] Can no longer target analysis in a selection [CT-2688] [Regression] Can no longer target analysis in a selection Jun 13, 2023
@moltar
Copy link
Author

moltar commented Jun 14, 2023

Hey @dbeatty10, thanks for the tip! No slash does indeed work. 🎉

I thought I'd tried everything, including that 😁

Other things I tried were using path: prefix, full paths from the root, etc...

Btw, for posterity, if anyone comes across this, one other thing needed in 1.5, for those who do not have dbt in the root:

export DBT_TARGET_PATH="$DBT_PROJECT_DIR/target"

This is due to a bug.

@dbeatty10
Copy link
Contributor

Hey @dbeatty10, thanks for the tip! No slash does indeed work. 🎉

Awesome, great news @moltar 🎉

This is due to a bug

Is #7465 the bug you are referring to?

If so, you can try out the 1.5.2rc1 release candidate which should include a fix for that issue.

Assuming we have everything covered, I'm going to close this issue as resolved. But please let me know if not, and I'll be happy to re-open.

@moltar
Copy link
Author

moltar commented Jun 14, 2023

Is #7465 the bug you are referring to?

Yes, that's the one.

Assuming we have everything covered

So, is not including the slash the solution?

If so, to be clear, dbt used to work with the slash, wondering if this would be a regression for others.

Or is the fix for no slash is part of the 1.5.2rc1 release too?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression
Projects
None yet
Development

No branches or pull requests

4 participants