Dbt: Support a flag to override the target and logs directories on the CLI

Created on 28 Feb 2020  路  3Comments  路  Source: fishtown-analytics/dbt

Describe the feature

Support --logs-path and --target-path in all dbt invocations (including dbt rpc).

These flags will override the destination path for the logs/ and target/ directories, respectively.

I think we should add this as a subcommand to dbt itself, eg:

$ dbt --logs-path log-dir --target-path target-dir
enhancement

All 3 comments

Hey i'd be happy to pick this up, could you point me in the right direction ?

Hi @gh4n, that would be awesome! There are a couple changes you'd have to make:

  • In core/dbt/main.py, add --target-path and --logs-path to main.py, where we add the other arguments to the root command. It should default to None.
  • In core/dbt/config/runtime.py, add something to the from_parts classmethod, probably around here, that sets the target_path and log_path parameters to cls to args.target_path/args.log_path if they're set, and falls back to the value from project if not.
  • Unit tests that make sure RuntimeConfig.from_parts behaves appropriately given the various permutations of logs/target path being set or not (I don't see any need for an integration test about this).

That'll probably break a number of existing unit tests as well: I know you'll have to update test/unit/utils.py to add those parameters to the Obj class, but I have a feeling there's at least one other place we create a fake args object as well.

Cool, I've made the fix, will make some changes to the unit tests tonight and raise a PR soon. Thanks for the help!

Was this page helpful?
0 / 5 - 0 ratings