diff --git a/.changes/unreleased/Features-20241202-095136.yaml b/.changes/unreleased/Features-20241202-095136.yaml new file mode 100644 index 000000000..973866a6d --- /dev/null +++ b/.changes/unreleased/Features-20241202-095136.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Support MicrobatchConcurrency +time: 2024-12-02T09:51:36.606097-05:00 +custom: + Author: michelleark + Issue: "1260" diff --git a/.changes/unreleased/Under the Hood-20241205-144036.yaml b/.changes/unreleased/Under the Hood-20241205-144036.yaml new file mode 100644 index 000000000..aedcb4ce1 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20241205-144036.yaml @@ -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" diff --git a/dbt/adapters/snowflake/impl.py b/dbt/adapters/snowflake/impl.py index ac0d903db..10ad2a8a1 100644 --- a/dbt/adapters/snowflake/impl.py +++ b/dbt/adapters/snowflake/impl.py @@ -77,6 +77,7 @@ class SnowflakeAdapter(SQLAdapter): Capability.TableLastModifiedMetadata: CapabilitySupport(support=Support.Full), Capability.TableLastModifiedMetadataBatch: CapabilitySupport(support=Support.Full), Capability.GetCatalogForSingleRelation: CapabilitySupport(support=Support.Full), + Capability.MicrobatchConcurrency: CapabilitySupport(support=Support.Full), } ) diff --git a/dbt/include/snowflake/macros/materializations/merge.sql b/dbt/include/snowflake/macros/materializations/merge.sql index 716a325c1..7515f6010 100644 --- a/dbt/include/snowflake/macros/materializations/merge.sql +++ b/dbt/include/snowflake/macros/materializations/merge.sql @@ -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}) %} diff --git a/setup.py b/setup.py new file mode 100644 index 000000000..e69de29bb