I am trying to build an incremental table using databrick’s replace_where method but unable to pass variables defined in dbt_project.yml to my mode l.sql where config is defined as below code.
It works fine with hardcoded values like "date <= '2024-06-20' "
but unable to pass start_date variable like "date >= "+start_date
The run errors up with :
'start_date' is undefined. This can happen when calling a macro that does not exist. Check for typos and/or install package dependencies with "dbt deps".
Note these variables work fine in sql statements too when used in filter condition as
date >= '{{ var("start_date") }}' AND date <= '{{ var("end_date") }}'
{{
config(
materialized = 'incremental',
file_format = 'delta',
partition_by = 'date',
incremental_strategy = 'replace_where',
incremental_predicates = ["date >= "+start_date, "date <= '2024-06-20' "]
)
}}