From d4a2b66a489aec7c92f507d4a3b86e94df26803a Mon Sep 17 00:00:00 2001 From: Michelle Ark Date: Fri, 13 Sep 2024 22:05:43 -0400 Subject: [PATCH] tidy up snowflake__get_incremental_microbatch_sql --- .../snowflake/macros/materializations/merge.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dbt/include/snowflake/macros/materializations/merge.sql b/dbt/include/snowflake/macros/materializations/merge.sql index 2acf95bad..9d082878a 100644 --- a/dbt/include/snowflake/macros/materializations/merge.sql +++ b/dbt/include/snowflake/macros/materializations/merge.sql @@ -53,12 +53,12 @@ {% macro snowflake__get_incremental_microbatch_sql(arg_dict) %} {% set incremental_predicates = [] if arg_dict.get('incremental_predicates') is none else arg_dict.get('incremental_predicates') %} {#-- Add additional incremental_predicates if it is safe to do so --#} - {% if model.config.event_time -%} - {% if model.config.event_time_start -%} - {% do incremental_predicates.append("DBT_INTERNAL_DEST" ~ "." ~ model.config.event_time ~ " >= " ~ model.__dbt_internal_microbatch_event_time_start) %} + {% if config.get("event_time") -%} + {% if config.get("__dbt_internal_microbatch_event_time_start") -%} + {% do incremental_predicates.append("DBT_INTERNAL_DEST" ~ "." ~ config.event_time ~ " >= " ~ config.__dbt_internal_microbatch_event_time_start) %} {% endif %} - {% if model.config.event_time_start -%} - {% do incremental_predicates.append("DBT_INTERNAL_DEST" ~ "." ~ model.config.event_time ~ " < " ~ model.__dbt_internal_microbatch_event_time_start) %} + {% if model.config.__dbt_internal_microbatch_event_time_end -%} + {% do incremental_predicates.append("DBT_INTERNAL_DEST" ~ "." ~ model.config.event_time ~ " < " ~ model.__dbt_internal_microbatch_event_time_end %} {% endif %} {% endif %} {% do arg_dict.update({'incremental_predicates': incremental_predicates}) %}