Before job runs everyday, I trying to create a partition_key variable = currentdate()-1 so that my pipeline would run for previous day but I am getting errors within DBT console
No filter named 'format_datetime'. line 2 set partition_key = dateadd('day', -1, CURRENT_DATE())|format_datetime('%Y-%m-%d') %}
Code I am using in the DBT :
{% macro yesterday_date() %}
{% set partition_key = dateadd('day', -1, CURRENT_DATE())|format_datetime('%Y-%m-%d') %}
{% endmacro %}
Also, tried to set Partition_key within my sql file but still it gave me the error.
I guess you already found a way to solve your problem as this question was posted 6 months ago, but I'll answer it in case someone else needs it.
Jinja is a templating language that uses some syntax from Python and where you cannot use your well-known SQL functions. To be able to get a date string for yesterday in Jinja, you need to write:
I hope this helps!