Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CT-2435] [Feature] Display model versions with dbt show #7407

Closed
3 tasks done
dbeatty10 opened this issue Apr 18, 2023 · 1 comment · Fixed by #7543 or #7878
Closed
3 tasks done

[CT-2435] [Feature] Display model versions with dbt show #7407

dbeatty10 opened this issue Apr 18, 2023 · 1 comment · Fixed by #7543 or #7878
Assignees
Labels
enhancement New feature or request model_versions

Comments

@dbeatty10
Copy link
Contributor

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

Describe the feature

When using model versioning + dbt show, it is not clear which output goes with which version.

For versioned models, maybe use naming similar to dbt list? So something like this:

Previewing node 'dim_customers.v1':

If possible, it would also be nice to sort them in their version order (either from latest to earliest or vice versa).

Example

$ dbt list
my_dbt_project.dim_customers.v1
my_dbt_project.dim_customers.v2
$ dbt show -s dim_customers
22:51:55  Running with dbt=1.5.0-rc1

22:51:56  Previewing node 'dim_customers':
| customer_id | country_name | model_version |
| ----------- | ------------ | ------------- |
|           1 | Nauru        |             1 |

22:51:56  Previewing node 'dim_customers':
| customer_id | country_name | model_version |
| ----------- | ------------ | ------------- |
|           1 | Nauru        |             3 |

22:51:56  Previewing node 'dim_customers':
| customer_id | country_name | model_version |
| ----------- | ------------ | ------------- |
|           1 | Nauru        |             2 |

Describe alternatives you've considered

Rather than all the versions of dim_customers, it might be more expected to specify the desired version in the selection syntax like this:

$ dbt show -s dim_customers.v2
23:04:45  Running with dbt=1.5.0-rc1

23:04:46  Previewing node 'dim_customers':
| customer_id | country_name | model_version |
| ----------- | ------------ | ------------- |
|           1 | Nauru        |             2 |

Who will this benefit?

No response

Are you interested in contributing this feature?

No response

Anything else?

No response

@dbeatty10 dbeatty10 added enhancement New feature or request triage labels Apr 18, 2023
@github-actions github-actions bot changed the title [Feature] Display model versions with dbt show [CT-2435] [Feature] Display model versions with dbt show Apr 18, 2023
@jtcohen6
Copy link
Contributor

Thanks @dbeatty10! I think it's a matter of updating this line, to include the node.version if available:

node_name=result.node.name,

As an implementation detail, it would make sense to me to define a new node method, something like pretty_name, which would return node.name by default and {node.name}.v{node.version} if a version is defined.

@aranke aranke closed this as completed in 40aca4b May 8, 2023
github-actions bot pushed a commit that referenced this issue May 9, 2023
jtcohen6 pushed a commit that referenced this issue May 10, 2023
)

(cherry picked from commit 40aca4b)

Co-authored-by: Kshitij Aranke <kshitij.aranke@dbtlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request model_versions
Projects
None yet
3 participants