Best practices
Putting it all togetherβ
- π We've walked through creating semantic models and metrics for basic coverage of a key business area.
- π In doing so we've looked at how to refactor a frozen rollup into a dynamic, flexible new life in the Semantic Layer.
Best practicesβ
- β Prefer normalization when possible to allow MetricFlow to denormalize dynamically for end users.
- β Use marts to denormalize when needed, for instance grouping tables together into richer components, or getting measures on dimensional tables attached to a table with a time spine.
- β When source data is well normalized you can build semantic models on top of staging models.
- β Prefer computing values in measures and metrics when possible as opposed to in frozen rollups.
- β Don't directly refactor the code you have in production, build in parallel so you can audit the Semantic Layer output and deprecate old marts gracefully.
Key commandsβ
- π Use
dbt parse
to generate a fresh semantic manifest. - π Use
dbt sl list dimensions --metrics [metric name]
to check that you're increasing dimensionality as you progress. - π Use
dbt sl query [query options]
to preview the output from your metrics as you develop.
Next stepsβ
- πΊοΈ Use these best practices to map out your team's plan to incrementally adopt the Semantic Layer.
- π€ Get involved in the community and ask questions, help craft best practices, and share your progress in building a dbt Semantic Layer.
- Validate semantic nodes in CI to ensure code changes made to dbt models don't break these metrics.
- dbt Semantic Layer cookbook recipes for more advanced use cases.
The dbt Semantic Layer is the biggest paradigm shift thus far in the young practice of analytics engineering. It's ready to provide value right away, but is most impactful if you move your project towards increasing normalization, and allow MetricFlow to do the denormalization for you with maximum dimensionality.
We will be releasing more resources soon covering implementation of the Semantic Layer in dbt Cloud with various integrated BI tools. This is just the beginning, hopefully this guide has given you a path forward for building your data platform in this new era. Refer to dbt Semantic Layer FAQs for more information.
0