From 5575fcef88f12050a1c414d6824617c5b6d1aa96 Mon Sep 17 00:00:00 2001 From: Justin Canney Date: Tue, 8 Oct 2024 10:28:50 -0400 Subject: [PATCH 1/4] incremental --- models/stg_iterable__user_history.sql | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/models/stg_iterable__user_history.sql b/models/stg_iterable__user_history.sql index 9e94753..e503021 100644 --- a/models/stg_iterable__user_history.sql +++ b/models/stg_iterable__user_history.sql @@ -1,9 +1,21 @@ +{{ config( + materialized='incremental', + unique_key=['_fivetran_user_id','updated_at'], + incremental_strategy='insert_overwrite' if target.type in ('bigquery', 'spark', 'databricks') else 'delete+insert', + partition_by={"field": "updated_at", "data_type": "date"} if target.type not in ('spark','databricks') else ['updated_at'], + file_format='parquet', + on_schema_change='fail' + ) +}} with base as ( select * from {{ ref('stg_iterable__user_history_tmp') }} + {% if is_incremental() %} + where updated_at >= coalesce((select max(updated_at) from {{ this }} ), '2010-01-01') + {% endif %} ), fields as ( From 11ae6cd17198f8f795e1e8c5c9e571bc9422accf Mon Sep 17 00:00:00 2001 From: Justin Canney Date: Tue, 8 Oct 2024 11:51:59 -0400 Subject: [PATCH 2/4] changelog and version --- CHANGELOG.md | 6 ++++++ dbt_project.yml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a2e2d9..572738f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# dbt_iterable_source v0.9.1 +[PR #33](https://github.com/fivetran/dbt_iterable_source/pull/33) contains the following updates: + +## Feature Updates +- Updated the `stg_iterable__user_history` model to be incremental. No new columns were introduced in this change. + # dbt_iterable_source v0.9.0 [PR #31](https://github.com/fivetran/dbt_iterable_source/pull/31) contains the following updates: diff --git a/dbt_project.yml b/dbt_project.yml index 88d12af..7847e45 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -1,7 +1,7 @@ config-version: 2 name: 'iterable_source' -version: '0.9.0' +version: '0.9.1' require-dbt-version: [">=1.3.0", "<2.0.0"] models: From 42927de49051c821ea0daf505af4a4275e45616f Mon Sep 17 00:00:00 2001 From: Justin Canney Date: Tue, 8 Oct 2024 11:53:11 -0400 Subject: [PATCH 3/4] version update --- integration_tests/dbt_project.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml index e48b946..0d0b0d8 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -1,7 +1,7 @@ config-version: 2 name: 'iterable_source_integration_tests' -version: '0.9.0' +version: '0.9.1' profile: 'integration_tests' vars: From 554fa2bedb27d185cbe521ed6c1cd2d0af24c794 Mon Sep 17 00:00:00 2001 From: Justin Canney Date: Tue, 8 Oct 2024 11:56:19 -0400 Subject: [PATCH 4/4] pr number --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 572738f..db3dd52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # dbt_iterable_source v0.9.1 -[PR #33](https://github.com/fivetran/dbt_iterable_source/pull/33) contains the following updates: +[PR #38](https://github.com/fivetran/dbt_iterable_source/pull/38) contains the following updates: ## Feature Updates - Updated the `stg_iterable__user_history` model to be incremental. No new columns were introduced in this change.