The correct answers are B: writing and using dbt macros and D: using dbt packages.
dbt strongly encourages DRY (Don't Repeat Yourself) principles, and two of the core mechanisms that support reusable logic are macros and packages. Macros allow you to write Jinja-powered reusable functions that can generate SQL statements dynamically, reducing duplication across models, tests, and project logic. Macros can encapsulate filters, joins, auditing logic, timestamps, and more—allowing developers to centralize logic in one place while referencing it across many models.
Packages extend this concept even further by allowing entire sets of macros, models, tests, and utilities to be imported into a project. Packages like dbt-utils contain widely used generic macros that help standardize transformations and testing. Using packages ensures consistent logic across teams and eliminates the need to rewrite common transformations.
Option A contradicts DRY principles because copy/pasting increases maintenance burden. Option C is not a mechanism for reusing logic; singular tests validate logic but do not reduce duplication. Option E simply changes a model’s materialization and does not support code reuse.
Thus, macros and packages are the only correct dbt mechanisms that provide reusable, modular, DRY logic.
Submit