Skip to content

Commit 6e75bbc

Browse files
b-perPedramNavid
andauthored
[docs] Update config dbt incremental model with partitions (#19530)
Without the additional config the model wouldn't be idempotent, as the incremental would be append only and rerunning a date would insert those again. When using `delete+insert`, the `unique_key` doesn't actually need to be unique (in comparison to `merge` that would fail if `unique_key` is not unique) ## Summary & Motivation Docs update ## How I Tested These Changes N/A --------- Co-authored-by: Pedram Navid <[email protected]>
1 parent e8befdc commit 6e75bbc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/content/integrations/dbt/reference.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,8 +940,8 @@ def partitionshop_dbt_assets(context: OpExecutionContext, dbt: DbtCliResource):
940940
With the variables defined, we can now reference `min_date` and `max_date` in our SQL and configure the dbt model as incremental. Here, we define an incremental run to operate on rows with `order_date` that is between our `min_date` and `max_date`.
941941

942942
```sql
943-
-- Configure the model as incremental
944-
{{ config(materialized='incremental') }}
943+
-- Configure the model as incremental, use a unique_key and the delete+insert strategy to ensure the pipeline is idempotent.
944+
{{ config(materialized='incremental', unique_key='order_date', incremental_strategy="delete+insert") }}
945945
946946
select * from {{ ref('my_model') }}
947947

0 commit comments

Comments
 (0)