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-2761] [Bug] dbt run-operation command does not honor DBT_TARGET_PATH or accept --target-path parameter #7986

Closed
2 tasks done
timvw opened this issue Jun 29, 2023 · 8 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@timvw
Copy link

timvw commented Jun 29, 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

Currently DBT_TARGET_PATH is not honored

Expected Behavior

DBT_TARGET_PATH is honored

Steps To Reproduce

DBT_TARGET_PATH=/tmp/target dbt run-operation create_job_monitoring_temporary_views

-> A ./target folder is created with following files: graph.gpickle, manifest.json and partial_parse.msgpack

Environment

- OS: mac
- Python: 3.7.16
- dbt: 1.5.1

Which database adapter are you using with dbt?

spark, other (mention it in "Additional Context")

Additional Context

This causes issues in constrained environments where not each (./target) folder is write-able.

When running dbt compile it is clear that DBT_TARGET_PATH is respected

DBT_TARGET_PATH=/tmp/target dbt compile --vars 'partition: 2023/6'

-> No ./target folder is created

@timvw timvw added bug Something isn't working triage labels Jun 29, 2023
@github-actions github-actions bot changed the title [Bug] dbt run-operation command does not honor DBT_TARGET_PATH or accept --target-path parameter [CT-2761] [Bug] dbt run-operation command does not honor DBT_TARGET_PATH or accept --target-path parameter Jun 29, 2023
@jtcohen6
Copy link
Contributor

@timvw I'm surprised you're noticing this difference in behavior between run-operation and compile — both of them definitely support the target_path parameter.

Could you try upgrading to v1.5.2? We included a fix in that patch release which sounds slightly different from the problem you're having, but could possibly be related:

@timvw
Copy link
Author

timvw commented Jun 29, 2023

Unfortunately no success

ls target
ls: target: No such file or directory
dbt run-operation create_job_monitoring_temporary_views
DBT_TARGET_PATH=/tmp/dbt dbt run-operation create_job_monitoring_temporary_views
09:18:10  Running with dbt=1.5.2
09:18:10  Registered adapter: spark=1.5.0
...
ls target 
graph.gpickle         manifest.json         partial_parse.msgpack

@timvw
Copy link
Author

timvw commented Jun 29, 2023

When I run dbt run-operation --help it does not mention the --target-path parameter
When I run dbt run --help it does mention the --target-path parameter (and DBT_TARGET_PATH)

(I know, in main.py i see that both operations have an @p.target_path attribute..)

But.. When I try to invoke dbt run-operation with a --target-path

dbt run-operation create_job_monitoring_temporary_views --target-path /tmp/dbt
Usage: dbt run-operation [OPTIONS] MACRO
Try 'dbt run-operation -h' for help.

Error: No such option: --target-path Did you mean --target?

@jtcohen6
Copy link
Contributor

Can you try putting the flag before the subcommand? It's a "global" flag:

dbt --target-path /tmp/dbt run-operation create_job_monitoring_temporary_views

(I'm not sure why that would work, and the env var wouldn't work, but just to try!)

@timvw
Copy link
Author

timvw commented Jun 29, 2023

The same result, not working..

dbt run-operation --target-path /tmp/dbt create_job_monitoring_temporary_views
Usage: dbt run-operation [OPTIONS] MACRO
Try 'dbt run-operation -h' for help.

Error: No such option: --target-path Did you mean --target?

@jtcohen6
Copy link
Contributor

@timvw I was suggesting that you put the --target-path in between dbt and run-operation

Again, I doubt it would have an actually different result versus setting the DBT_TARGET_PATH env var, but worth a shot just in case

@timvw
Copy link
Author

timvw commented Jun 29, 2023

Also no success...

dbt --target-path /tmp/dbt run-operation create_job_monitoring_temporary_views
Usage: dbt [OPTIONS] COMMAND [ARGS]...
Try 'dbt -h' for help.

Error: No such option: --target-path Did you mean --log-path?

@jtcohen6
Copy link
Contributor

Ah! We added target-path to run-operation in #7647, but we only just backported it to 1.5.latest (#7961), for inclusion in the next patch release of v1.5. So this will be fixed when we release v1.5.3 (planned for July):

Sorry for the run-around. I'm positive that's what's at play here. I'm going to close this as a duplicate of #7953

@jtcohen6 jtcohen6 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 29, 2023
@jtcohen6 jtcohen6 added duplicate This issue or pull request already exists and removed triage labels Jun 29, 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 duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants