Skip to content

Commit

Permalink
Adding semantic models to list (#4156)
Browse files Browse the repository at this point in the history
Previews:
- [The "semantic_model"
method](https://docs-getdbt-com-git-backport-semantic-dbt-labs.vercel.app/reference/node-selection/methods#the-semantic_model-method)
- [About dbt ls (list)
command](https://docs-getdbt-com-git-backport-semantic-dbt-labs.vercel.app/reference/commands/list)
- [Upgrading to
v1.6](https://docs-getdbt-com-git-backport-semantic-dbt-labs.vercel.app/guides/migration/versions/upgrading-to-v1.6)

## What are you changing in this pull request and why?

Adding semantic model support to `list` for dbt v1.6+

Resolves: #4134

## Checklist

- [x] Add versioning components, as described in [Versioning
Docs](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-entire-pages)
- [x] Add a note to the prerelease version [Migration
Guide](https://github.com/dbt-labs/docs.getdbt.com/tree/current/website/docs/guides/migration/versions)

- [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.
- [x] Add a checklist item for anything that needs to happen before this
PR is merged, such as "needs technical review" or "change base branch."
  • Loading branch information
matthewshaver authored Oct 12, 2023
2 parents aea7021 + 1fbac66 commit dc121c4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,5 @@ More consistency and flexibility around packages. Resources defined in a package
- [`dbt debug --connection`](/reference/commands/debug) to test just the data platform connection specified in a profile
- [`dbt docs generate --empty-catalog`](/reference/commands/cmd-docs) to skip catalog population while generating docs
- [`--defer-state`](/reference/node-selection/defer) enables more-granular control
- [`dbt ls`](/reference/commands/list) adds the Semantic model selection method to allow for `dbt ls -s "semantic_model:*"` and the ability to execute `dbt ls --resource-type semantic_model`.

12 changes: 11 additions & 1 deletion website/docs/reference/commands/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The `dbt ls` command lists resources in your dbt project. It accepts selector ar
### Usage
```
dbt ls
[--resource-type {model,source,seed,snapshot,metric,test,exposure,analysis,default,all}]
[--resource-type {model,semantic_model,source,seed,snapshot,metric,test,exposure,analysis,default,all}]
[--select SELECTION_ARG [SELECTION_ARG ...]]
[--models SELECTOR [SELECTOR ...]]
[--exclude SELECTOR [SELECTOR ...]]
Expand Down Expand Up @@ -93,6 +93,16 @@ $ dbt ls --select snowplow.* --output json --output-keys name resource_type desc

</VersionBlock>

<VersionBlock firstVersion="1.6">

**Listing Semantic models**

List all resources upstream of your orders semantic model:
```
dbt ls -s +semantic_model:orders
```

</VersionBlock>

**Listing file paths**
```
Expand Down
15 changes: 15 additions & 0 deletions website/docs/reference/node-selection/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,18 @@ dbt list --select version:none # models that are *not* versioned
```
</VersionBlock>
### The "semantic_model" method
<VersionBlock lastVersion="1.5">
Supported in v1.6 or newer.
</VersionBlock>
<VersionBlock firstVersion="1.6">
The `semantic_model` method selects [semantic models](/docs/build/semantic-models).
```bash
dbt list --select semantic_model:* # list all semantic models
dbt list --select +semantic_model:orders # list your semantic model named "orders" and all upstream resources
```
</VersionBlock>

0 comments on commit dc121c4

Please sign in to comment.