dbt-core icon indicating copy to clipboard operation
dbt-core copied to clipboard

[CT-3021] [Spike+] Interactive `dbt show` should not require model `name` to be present in `--select` arg

Open jtcohen6 opened this issue 2 years ago • 4 comments

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:<path/to/file> 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:<path/to/versioned/model/file> --indirect-selection empty and dbt show --select path:<path/to/versioned/model/file> --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.

jtcohen6 avatar Aug 23 '23 11:08 jtcohen6

As discussed in refinement:

  • let's spike this
  • if it's a straightforward fix, go ahead and fix it!

graciegoheen avatar Aug 28 '23 15:08 graciegoheen

Exp/IDE. They will need to start passing --indirect-selection empty when doing --select interactive compiles/previews.

@jtcohen6 What is the timeline on this?

graciegoheen avatar Sep 08 '23 19:09 graciegoheen

@jtcohen6 What is the timeline on this?

I believe they're now doing this (slack thread), so no outstanding blockers here

jtcohen6 avatar Oct 25 '23 03:10 jtcohen6