Skip to content

Commit

Permalink
[Refactor] use new model.batch context vars (#1258)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleArk authored Dec 5, 2024
1 parent 86cf6e6 commit 457c361
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Under the Hood-20241205-144036.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Under the Hood
body: Use new `batch` context variables over `node.config.__dbt_internal` ones
time: 2024-12-05T14:40:36.373637-05:00
custom:
Author: michelleark
Issue: "1263"
4 changes: 2 additions & 2 deletions dbt/include/snowflake/macros/materializations/merge.sql
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@
{%- set incremental_predicates = [] if arg_dict.get('incremental_predicates') is none else arg_dict.get('incremental_predicates') -%}

{#-- Add additional incremental_predicates to filter for batch --#}
{% if model.config.get("__dbt_internal_microbatch_event_time_start") -%}
{% if model.batch and model.batch.event_time_start -%}
{% do incremental_predicates.append("DBT_INTERNAL_TARGET." ~ model.config.event_time ~ " >= to_timestamp_tz('" ~ model.config.__dbt_internal_microbatch_event_time_start ~ "')") %}
{% endif %}
{% if model.config.__dbt_internal_microbatch_event_time_end -%}
{% if model.batch and model.batch.event_time_end -%}
{% do incremental_predicates.append("DBT_INTERNAL_TARGET." ~ model.config.event_time ~ " < to_timestamp_tz('" ~ model.config.__dbt_internal_microbatch_event_time_end ~ "')") %}
{% endif %}
{% do arg_dict.update({'incremental_predicates': incremental_predicates}) %}
Expand Down

0 comments on commit 457c361

Please sign in to comment.