[CT-3318] [Feature] Support the `group` resource type within `dbt list`
- Dominant language
- Rust
- Stars
- 13.8k
- Forks
- 2.6k
- Avg merge
- 21h 31m
- Merged PRs (30d)
- 56
Description
### Is this your first time submitting a feature request?
- [X] I have read the [expectations for open source contributors](https://docs.getdbt.com/docs/contributing/oss-expectations)
- [X] I have searched the existing issues, and I could not find an existing issue for this feature
- [X] I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion
### Describe the feature
In order to find the file in which a group is defined, I'd like to be able to do one or more of the following:
```shell
dbt list --resource-type group
dbt list --resource-type group --output path
dbt -q list --resource-type group --output json --output-keys name path
```
But currently get the following message:
```
$ dbt list --resource-type group
Usage: dbt list [OPTIONS]
Try 'dbt list -h' for help.
Error: Invalid value for '--resource-types' / '--resource-type': 'group' is not one of 'metric', 'semantic_model', 'source', 'analysis', 'model', 'test', 'exposure', 'snapshot', 'seed', 'default', 'all'.
```
A regular listing will show that I have 1 group defined though:
```
$ dbt list
12:42:12 Running with dbt=1.7.0
12:42:15 Registered adapter: snowflake=1.7.0
12:42:15 Found 2 models, 0 sources, 0 exposures, 0 metrics, 378 macros, 1 group, 0 semantic models
```
### Describe alternatives you've considered
Currently, some options are:
- to intuitively know where the group is defined (e.g., using a known convention across my project)
- use some kind of code search for the group name (like `grep`)
- inspect [`manifest.json`](https://docs.getdbt.com/reference/artifacts/manifest-json)
None of these are particularly ergonomic or dbt-onic.
The last one is probably the easiest for those that know where to find this file and apply pretty-print formatting for human readability.
### Who will this benefit?
This will benefit folks that already know how to use `dbt list` and want to use it for all the types of resources within their project.
### Are you interested in contributing this feature?
_No response_
### Anything else?
### Declaring a group
- https://docs.getdbt.com/docs/build/groups#declaring-a-group
`models/marts/finance/finance.yml`
```yaml
groups:
- name: finance
owner:
email: finance@jaffleshop.com
```
### Groups within the manifest
Here's a subset of my `manifest.json` after `dbt parse`:
```json
"groups": {
"group.my_project.finance": {
"name": "finance",
"resource_type": "group",
"package_name": "my_project",
"path": "finance.yml",
"original_file_path": "models/marts/finance/finance.yml",
"unique_id": "group.my_project.finance",
"owner": {
"email": "finance@jaffleshop.com",
"name": null
}
}
},
```
Contributor guide
Assessment
This issue has not been assessed yet.