Skip to content

Commit 9cd6a23

Browse files
authored
add compile test for batch context vars (#12261)
1 parent e46c37c commit 9cd6a23

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/functional/microbatch/test_microbatch.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,15 @@ def test_run_with_event_time_logs(self, project):
598598
assert "batch.event_time_end: 2020-01-03 13:57:00+00:00" in logs
599599
assert "batch.id: 20200103" in logs
600600

601+
# compile does not have access to populated batch context vars, but should not break on access
602+
with patch_microbatch_end_time("2020-01-03 13:57:00"):
603+
_, compile_logs = run_dbt_and_capture(["compile"])
604+
605+
assert "start:" in compile_logs
606+
assert "end:" in compile_logs
607+
assert "batch.event_time_start:" not in compile_logs
608+
assert "batch.event_time_end:" not in compile_logs
609+
601610

602611
microbatch_model_failing_incremental_partition_sql = """
603612
{{ config(materialized='incremental', incremental_strategy='microbatch', unique_key='id', event_time='event_time', batch_size='day', begin=modules.datetime.datetime(2020, 1, 1, 0, 0, 0)) }}

0 commit comments

Comments
 (0)