How to use macro as a macro variable in dbt

Viewed 36

I'm calling my dbt macro date_diff_precise, with value returned by another macro run_time being the second variable begin_date

{{ date_diff_precise(time_period = "'day'",
                     begin_date = {{ run_time() }},
                     end_date = end_date,
                     return_negative_date_diff = 'FALSE') }}

This would raise a compilation error that

enter image description here

My environment: VSCode, Athena/Presto

1 Answers

Don't Nest Your Curlies

{{ date_diff_precise(time_period = "'day'",
                     begin_date = run_time(),
                     end_date = end_date,
                     return_negative_date_diff = 'FALSE') }}
Related