The missing guide to debug() in dbt
Editor's note—this post assumes intermediate knowledge of Jinja and macros development in dbt. For an introduction to Jinja in dbt check out the documentation and the free self-serve course on Jinja, Macros, Packages.
Jinja brings a lot of power to dbt, allowing us to use ref()
, source()
, conditional code, and macros. But, while Jinja brings flexibility, it also brings complexity, and like many times with code, things can run in expected ways.
The debug()
macro in dbt is a great tool to have in the toolkit for someone writing a lot of Jinja code, but it might be difficult to understand how to use it and what benefits it brings.
Let’s dive into the last time I used debug()
and how it helped me solve bugs in my code.