Hey everyone! I had a question regarding dbt Does...
# plugins-dbt
s
Hey everyone! I had a question regarding dbt Does anyone have a way to view star schema matrices? To see relationships between different dims and facts. I would love to automate the process of sharing that information with my team
s
Yeah docs does create a lineage (which is really cool), but I'm more speaking about interaction between dim and fact tables (without carring about the underlying staging tables) Basically I want to create a front-facing contract. Does that make sense?
v
You can filter dbt docs to just be your dimension tables like put "dim+" in the model search at the bottom. I don't understand I guess I"m sure other folks get it. Programmatically yes the relationships are all there in the dbt manifest, for those things I tend to just use dbt docs
s
I guess what I'm saying is that dbt docs models EXISTING relationships (
from {{ref("my_model")}}
), but what I want to model is intended relationships ( these dims are related to this fact table through this pimary key, and these dims are related to this other fact table in that fact table There is no explicit join between these tables because that defeats the purpose of having them seperate, e.g. from my understanding you can't visualize them properly in the docs
Basically a more detailed version of outputing this, if that makes sense
v
ahh I think I get what problem you're trying to solve. I've never found a great solution generally to this problem. A lot of folks like ERD diagrams, or diagrams that show a bunch of tables and how the keys relate to each other. For the specific solution to you since you control the dim/fact tables then make a consistent naming structure for keys. dbt is pretty opioninated on them https://github.com/dbt-labs/corp/blob/main/dbt_style_guide.md#:~:text=Each%20model%20should%20have%20a%20primary%20key%20that%20can%20identify%20the%20unique%20row%2C%20and%20should%20be%20named%20%3Cobject%3E_id%2C%20e.g.%20account_id%20%E2%80%93%20this%20makes%20it%20easier%20to%20know%20what%20id%20is%20being%20referenced%20in%20downstream%20joined%20models. Then you train on that internally. Another fun thing to do would be a few example models that tie some dims and facts together and then dbt docs would show them with pretty lines
s
@taylor would you have any insights? I found that you were looking into this as far back as 2020 https://github.com/dbt-labs/dbt-docs/issues/84#issuecomment-651201071
t
I never found a great solution for this
s
Guess I'll keep looking, but thanks! I got a suggestion from another thread to try this: https://github.com/dbt-labs/dbt-project-evaluator
@taylor update: Maybe this could be used to solve my issue. From my understanding, this allows us to identify fact tables in your dbt workflow https://docs.getdbt.com/docs/build/metrics