datnguye/dbterd

[FEAT] Select wanted models for graph

Closed this issue · 6 comments

First of all, great tool! I've been trying to find a tool like this that could generate ERD diagrams on the fly from dbt project files.

Is your feature request related to a problem? Please describe.
I would like to generate an independent graph per exposure in my dbt project. The CLI itself works pretty well but I feel limited by the options the --select commands provides since it's based on pattern matching.

Describe the solution you'd like
I would like to run
dbterd run -s "list:mymodel1,mymodel2" or something similar. Basically giving a comma separated list of models I would like to render in the graph.

Describe alternatives you've considered
I haven't figured any way I could work around this problem since I can't give the CLI tool multiple model names as input when they're in same schema

Thanks @RecMarkoL for raising the request.

Just wanted to confirm one thing before I make a PR and the new version for this.
Since your original need is to select the dbt exposures, I can make an option for that instead of the suggested one:

dbterd run —select exposure:name

Does it sound better?
Additionally, what about schema selection as an option here?

Thanks

I think a general selection of models to include in the ERD would be better than making a dedicated one for exposures.

I can get the models I want to render from dbt cli with dbt ls command regardless if they belong to an exposure or not. The exposure was just an example of utilizing the model selection :)

In that case, the multiple select should be the right solution for you here, for example:

dbterd run -s model1 -s model2 -s model3…

I will try to work on your suggested one as well.

Ah, didn't realize I could've chained multiple selects into the query..

In that case the

dbterd run —select exposure:name

Would be a very nice addition. Schema selection could be handy but I think the first iteration of the new select functionality doesn't have to include it

Cheers @RecMarkoL
The schema selection is already available 👯
Check out the docs here: https://dbterd.datnguyen.de/1.3/nav/guide/cli-references.html#-select-s

You should be now selecting by the dbt exposure name in dbterd v1.4