Skip to content

Commit

Permalink
Placement of command options (#3735)
Browse files Browse the repository at this point in the history
## What are you changing in this pull request and why?

In v1.5, some options need to come before the sub-command and some
after. Adding description of these changes in:

- https://docs.getdbt.com/guides/migration/versions/upgrading-to-v1.5
- https://docs.getdbt.com/reference/project-configs/log-path

Resolves #3470
Resolves #3339 

## Checklist
- [x] Review the [Content style
guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md)
and [About
versioning](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version)
so my content adheres to these guidelines.
- [ ] Needs review from product team
  • Loading branch information
nghi-ly authored Aug 1, 2023
2 parents 6367dbb + aa1ab3d commit ebc6b41
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 5 deletions.
45 changes: 44 additions & 1 deletion website/docs/guides/migration/versions/02-upgrading-to-v1.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,50 @@ models:
tests: [] # todo! add tests later
config: ...
```
Some options that could previously be specified before a sub-command can now only be specified afterward. For example, `dbt --profiles-dir . run` isn't valid anymore, and instead, you need to use `dbt run --profiles-dir .`
Some options that could previously be specified _after_ a subcommand can now only be specified _before_. This includes the inverse of the option, `--write-json` and `--no-write-json`, for example. The list of affected options are:

<details>
<summary>List of affected options</summary>

```bash
--cache-selected-only | --no-cache-selected-only
--debug, -d | --no-debug
--deprecated-print | --deprecated-no-print
--enable-legacy-logger | --no-enable-legacy-logger
--fail-fast, -x | --no-fail-fast
--log-cache-events | --no-log-cache-events
--log-format
--log-format-file
--log-level
--log-level-file
--log-path
--macro-debugging | --no-macro-debugging
--partial-parse | --no-partial-parse
--partial-parse-file-path
--populate-cache | --no-populate-cache
--print | --no-print
--printer-width
--quiet, -q | --no-quiet
--record-timing-info, -r
--send-anonymous-usage-stats | --no-send-anonymous-usage-stats
--single-threaded | --no-single-threaded
--static-parser | --no-static-parser
--use-colors | --no-use-colors
--use-colors-file | --no-use-colors-file
--use-experimental-parser | --no-use-experimental-parser
--version, -V, -v
--version-check | --no-version-check
--warn-error
--warn-error-options
--write-json | --no-write-json
```

</details>


Additionally, some options that could be previously specified _before_ a subcommand can now only be specified _after_. Any option _not_ in the above list must appear _after_ the subcommand from v1.5 and later. For example, `--profiles-dir`.


The built-in [collect_freshness](https://github.com/dbt-labs/dbt-core/blob/1.5.latest/core/dbt/include/global_project/macros/adapters/freshness.sql) macro now returns the entire `response` object, instead of just the `table` result. If you're using a custom override for `collect_freshness`, make sure you're also returning the `response` object; otherwise, some of your dbt commands will never finish. For example:
Expand Down
13 changes: 11 additions & 2 deletions website/docs/reference/project-configs/log-path.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,21 @@ The precedence order is: CLI flag > env var > `dbt_project.yml`
</VersionBlock>

## Examples
### Write logs to a subdirectory named `dbt_logs` instead of `logs`
### Specify subdirectory using the project config file

<File name='dbt_project.yml'>

```yml
log-path: dbt_logs
```

</File>

<VersionBlock firstVersion="1.5">

### Specify subdirectory from the command line

```bash
dbt --log-path dbt_logs run
```

</VersionBlock>
14 changes: 12 additions & 2 deletions website/docs/reference/project-configs/target-path.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,22 @@ The precedence order is: CLI flag > env var > `dbt_project.yml`
</VersionBlock>

## Examples
### Use a subdirectory named `compiled` for compiled files
### Specify subdirectory using the project config file

<File name='dbt_project.yml'>

```yml
target-path: "compiled"
target-path: "compiled_files"
```

</File>

<VersionBlock firstVersion="1.5">

### Specify subdirectory from the command line

```bash
dbt run --target-path compiled_files
```

</VersionBlock>

0 comments on commit ebc6b41

Please sign in to comment.