When executing dbt run, dbt test, dbt compile or dbt compile, compiled SQL files are written to the target-path (by default ./target/) relative to the current path. So if you're jumping around the directory tree and run dbt commands in the wrong folder, a new target/ dir is created and populated in the current working directory.
The target folder can be configured to be just about anywhere including an absolute path somewhere.
Questions:
- Why would dbt use relative paths for the target?
- By extension, why would dbt not default to using something like
/tmp/dbt-target-<dbt-project>/? - Is it a bad idea to set
target-pathto an absolute path such as a subdir in/tmp/?
I've tried running the dbt commands with the flag --target-path /tmp/dbt-<my-project>/ with no adverse effects so far.