Skip to content

Commit 1cf2305

Browse files
add test validation for merge_filter as well
1 parent 717a611 commit 1cf2305

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

.circleci/continue_config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,10 @@ workflows:
303303
- bigquery
304304
- clickhouse-cloud
305305
- athena
306-
# filters:
307-
# branches:
308-
# only:
309-
# - main
306+
filters:
307+
branches:
308+
only:
309+
- main
310310
- ui_style
311311
- ui_test
312312
- vscode_test

tests/core/engine_adapter/integration/test_integration.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1947,6 +1947,7 @@ def test_incremental_by_unique_key_model_when_matched(ctx: TestContext):
19471947
kind INCREMENTAL_BY_UNIQUE_KEY (
19481948
unique_key item_id,
19491949
batch_size 1,
1950+
merge_filter source.event_date > target.event_date,
19501951
when_matched WHEN MATCHED THEN UPDATE SET target.value = source.value, target.event_date = source.event_date
19511952
),
19521953
{table_format}
@@ -1968,8 +1969,17 @@ def test_incremental_by_unique_key_model_when_matched(ctx: TestContext):
19681969

19691970
test_model = context.get_model(f"{schema}.test_model_when_matched")
19701971

1971-
# Verify that the model has the when_matched clause configured
1972+
# Verify that the model has the when_matched clause and merge_filter
19721973
assert test_model.kind.when_matched is not None
1974+
assert (
1975+
test_model.kind.when_matched.sql()
1976+
== '(WHEN MATCHED THEN UPDATE SET "__MERGE_TARGET__"."value" = "__MERGE_SOURCE__"."value", "__MERGE_TARGET__"."event_date" = "__MERGE_SOURCE__"."event_date")'
1977+
)
1978+
assert test_model.merge_filter is not None
1979+
assert (
1980+
test_model.merge_filter.sql()
1981+
== '"__MERGE_SOURCE__"."event_date" > "__MERGE_TARGET__"."event_date"'
1982+
)
19731983

19741984
actual_df = (
19751985
ctx.get_current_data(test_model.fqn).sort_values(by="item_id").reset_index(drop=True)

0 commit comments

Comments
 (0)