Replies: 1 comment
-
Just remembered that I first wrote a proposal in this vein as a way of building toward "dry run" materializations (#4456). In this version, I'd actually envisioned four types of macros. Copying my notes from several months ago:
|
Beta Was this translation helpful? Give feedback.
-
Adapted from #6278 (comment)
We enable a small subset of configurations to accept macros whose return values are "late-rendered" at runtime, instead of just being resolved at parse time. The two are
pre-hook
andpost-hook
, and while I love them dearly, they are also the banes of my existence: https://docs.getdbt.com/docs/building-a-dbt-project/dont-nest-your-curlies#an-exceptionWe need a more generally sensible rule about what dbt can expect to know when. We've talked a bit about "decorators" for macros that would indicate whether they're:
.yml
files!partitions
andmerge_update_columns
.truncate
ordelete
!More on pure macros
I know lots of folks have been interested in support for "pure" macros in
.yml
files, to DRY up the same config that they currently have to copy-paste around a bunch of different files. Think: conditionaldatabase
forsources
(#4753),where
fortests
(#6236 / #5940 / #4103), ... We also discussed this over in #6170, as a potential future avenue forvars
that might look & feel more likesnippets
.In a similar vein to #4999, I'm not sure if we can do this with actual Jinja, or if we'd need our own compilation / templating engine. I sure would like the idea of moving away from Jinja-in-YAML...
Beta Was this translation helpful? Give feedback.
All reactions