Skip to content

Commit

Permalink
Functional test for hourly microbatch model
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeatty10 committed Jan 16, 2025
1 parent 3de3b82 commit 1500222
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/functional/microbatch/test_microbatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@
select * from {{ ref('input_model') }}
"""

microbatch_hourly_model_sql = """
{{ config(materialized='incremental', incremental_strategy='microbatch', unique_key='id', event_time='event_time', batch_size='hour', begin=modules.datetime.datetime(2020, 1, 1, 0, 0, 0)) }}
select * from {{ ref('input_model') }}
"""

microbatch_yearly_model_sql = """
{{ config(materialized='incremental', incremental_strategy='microbatch', unique_key='id', event_time='event_time', batch_size='year', begin=modules.datetime.datetime(2020, 1, 1, 0, 0, 0)) }}
select * from {{ ref('input_model') }}
Expand Down Expand Up @@ -886,6 +891,19 @@ def test_run_with_event_time(self, project):
self.assert_row_count(project, "microbatch_model", 3)


class TestMicrbobatchModelsHourly(BaseMicrobatchTest):

@pytest.fixture(scope="class")
def models(self):
return {
"input_model.sql": input_model_sql,
"microbatch_model.sql": microbatch_hourly_model_sql,
}

def test_microbatch(self, project) -> None:
run_dbt(["run"])


class TestMicrbobatchModelsRunWithSameCurrentTime(BaseMicrobatchTest):

@pytest.fixture(scope="class")
Expand Down

0 comments on commit 1500222

Please sign in to comment.