This repository was archived by the owner on Sep 2, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +22
-2
lines changed
dbt/include/snowflake/macros/materializations Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 1+ kind : Fixes
2+ body : Use timestamp_tz type in microbatch `delete` DDL
3+ time : 2024-11-27T16:22:04.103212-05:00
4+ custom :
5+ Author : michelleark
6+ Issue : " 1256"
Original file line number Diff line number Diff line change 5858
5959 {# -- Add additional incremental_predicates to filter for batch --#}
6060 {% if model .config .get(" __dbt_internal_microbatch_event_time_start" ) - %}
61- {% do incremental_predicates .append (" DBT_INTERNAL_TARGET." ~ model .config .event_time ~ " >= TIMESTAMP '" ~ model .config .__dbt_internal_microbatch_event_time_start ~ " '" ) %}
61+ {% do incremental_predicates .append (" DBT_INTERNAL_TARGET." ~ model .config .event_time ~ " >= to_timestamp_tz( '" ~ model .config .__dbt_internal_microbatch_event_time_start ~ " ') " ) %}
6262 {% endif %}
6363 {% if model .config .__dbt_internal_microbatch_event_time_end - %}
64- {% do incremental_predicates .append (" DBT_INTERNAL_TARGET." ~ model .config .event_time ~ " < TIMESTAMP '" ~ model .config .__dbt_internal_microbatch_event_time_end ~ " '" ) %}
64+ {% do incremental_predicates .append (" DBT_INTERNAL_TARGET." ~ model .config .event_time ~ " < to_timestamp_tz( '" ~ model .config .__dbt_internal_microbatch_event_time_end ~ " ') " ) %}
6565 {% endif %}
6666 {% do arg_dict .update ({' incremental_predicates' : incremental_predicates}) %}
6767
Original file line number Diff line number Diff line change 33 BaseMicrobatch ,
44)
55
6+ # Create input with UTC timestamps
7+ _input_model_sql = """
8+ {{ config(materialized='table', event_time='event_time') }}
9+ select 1 as id, to_timestamp_tz('2020-01-01 00:00:00-0') as event_time
10+ union all
11+ select 2 as id, to_timestamp_tz('2020-01-02 00:00:00-0') as event_time
12+ union all
13+ select 3 as id, to_timestamp_tz('2020-01-03 00:00:00-0') as event_time
14+ """
15+
616
717# No requirement for a unique_id for snowflake microbatch!
818_microbatch_model_no_unique_id_sql = """
@@ -16,6 +26,10 @@ class TestSnowflakeMicrobatch(BaseMicrobatch):
1626 def microbatch_model_sql (self ) -> str :
1727 return _microbatch_model_no_unique_id_sql
1828
29+ @pytest .fixture (scope = "class" )
30+ def input_model_sql (self ) -> str :
31+ return _input_model_sql
32+
1933 @pytest .fixture (scope = "class" )
2034 def insert_two_rows_sql (self , project ) -> str :
2135 test_schema_relation = project .adapter .Relation .create (
You can’t perform that action at this time.
0 commit comments