How to Script Dimensions with data build tool (dbt) Macros


 

In previous articles we introduced the popular data engineering tool dbt (data build tool). We showed you how you can transform data in a Microsoft Fabric warehouse and how you can create tables with dbt models. We also demonstrated how you can use macros and Jinja to mimic the behavior of dynamic SQL (which we all know and love to use for our scripting), and apply this to create a date dimension.

In this article, we’ll revisit the dimension models we created. We wrote the entire SQL statement for the dimension by hand, and the dimensions themselves were very rudimentary;