Skip to main content

Reuse for dbts

Reuse in dbt means removing repeated SQL with Jinja templating and macros. Jinja adds loops, conditionals and variables inside SQL files, and a macro is a reusable function defined in the macros folder. Packages such as dbt_utils provide ready-made macros, so teams share logic instead of copying it.

Stage: Quality · Part of the dbt roadmap · Last reviewed 19 November 2026

What to learn in Reuse

Reuse interview questions

What is a dbt macro?

A macro is a reusable block of Jinja that generates SQL, defined in a macros file and called like a function. It removes copy-pasted logic, such as converting cents to dollars, and lets you change behaviour in one place.

How do you debug a Jinja error in a model?

Run dbt compile and read the rendered SQL in the target/compiled folder to see what Jinja produced. Check the logs for the file and line, print values with the log function, and simplify the macro until the output is correct.

Where Reuse fits in the dbt roadmap

Reuse belongs to the Quality stage (intermediate level). Trust the data.

Back to the full dbt roadmap