[CT-3021] [Spike+] Interactive `dbt show` should not require model `name` to be present in `--select` arg
- Dominant language
- Rust
- Stars
- 13.8k
- Forks
- 2.6k
- Avg merge
- 21h 31m
- Merged PRs (30d)
- 56
Description
### Housekeeping
- [X] I am a maintainer of dbt-core
### Short description
When "interactive" `dbt compile` or `dbt show` are passed selection criteria that selects a single node, always include that node's compiled/previewed result in the logs.
If:
- you have a versioned model using the `defined_in` version config
- the filename you choose does not contain the model name
- you use the `--select path:` method to unambiguously identify that resource (plus `--indirect-selection empty` to exclude any tests defined on that model)
Current state: Because the model's `name` is not explicitly included in the `--select` argument, the compiled/previewed result is missing from the logs.
Acceptance state: `dbt show` _always_ includes the compiled/previewed result if exactly one node has been selected for compilation/preview.
### Acceptance criteria
Following the test case described above — a versioned model with a `name` different from its `defined_in` file name, with generic tests defined on it:
- Current state: `dbt compile --select path: --indirect-selection empty` and `dbt show --select path: --indirect-selection empty` do not include the compiled/previewed result in the logs
- Acceptance state: Those commands **must** include the compiled/previewed result in the logs
### Impact to Other Teams
Exp/IDE. They will need to start passing `--indirect-selection empty` when doing `--select` interactive compiles/previews.
### Will backports be required?
1.5.latest + 1.6.latest
### Context
Currently, both "interactive" commands (`dbt compile` and `dbt show`) require that a model's `name` be explicitly included in the `--select` argument, when deciding which compiled / previewed result(s) to include in log output:
https://github.com/dbt-labs/dbt-core/blob/582faa129e8516bae38a4d42d4f8ed7892d4a99a/core/dbt/task/compile.py#L79-L83
https://github.com/dbt-labs/dbt-core/blob/582faa129e8516bae38a4d42d4f8ed7892d4a99a/core/dbt/task/show.py#L67-L70
While this is nice as a way of supporting `dbt show --select model_one model_two`, it also limits the other types of selection criteria (namely `path:` selection) that can be used to unambiguously select a single resource.
Contributor guide
Assessment
This issue has not been assessed yet.