-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* first pass: add incremental_predicates * safely add incremental_predicates + testing * remove requirement for unique_id --------- Co-authored-by: Quigley Malcolm <[email protected]>
- Loading branch information
1 parent
49623d7
commit 3cbe12f
Showing
4 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Features | ||
body: Microbatch incremental strategy | ||
time: 2024-09-13T21:54:16.492885-04:00 | ||
custom: | ||
Author: michelleark | ||
Issue: "1182" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pytest | ||
from dbt.tests.adapter.incremental.test_incremental_microbatch import ( | ||
BaseMicrobatch, | ||
) | ||
|
||
|
||
# No requirement for a unique_id for snowflake microbatch! | ||
_microbatch_model_no_unique_id_sql = """ | ||
{{ config(materialized='incremental', incremental_strategy='microbatch', event_time='event_time', batch_size='day') }} | ||
select * from {{ ref('input_model') }} | ||
""" | ||
|
||
|
||
class TestSnowflakeMicrobatch(BaseMicrobatch): | ||
@pytest.fixture(scope="class") | ||
def microbatch_model_sql(self) -> str: | ||
return _microbatch_model_no_unique_id_sql | ||
|
||
@pytest.fixture(scope="class") | ||
def insert_two_rows_sql(self, project) -> str: | ||
test_schema_relation = project.adapter.Relation.create( | ||
database=project.database, schema=project.test_schema | ||
) | ||
return f"insert into {test_schema_relation}.input_model (id, event_time) values (4, '2020-01-04 00:00:00-0'), (5, '2020-01-05 00:00:00-0')" |