@@ -3012,6 +3012,8 @@ def test_evaluate_incremental_by_partition(mocker: MockerFixture, make_snapshot,
30123012 snapshot = make_snapshot (model )
30133013 snapshot .categorize_as (SnapshotChangeCategory .BREAKING )
30143014
3015+ adapter_mock .columns .return_value = model .columns_to_types
3016+
30153017 evaluator = SnapshotEvaluator (adapter_mock )
30163018 evaluator .evaluate (
30173019 snapshot ,
@@ -3021,6 +3023,36 @@ def test_evaluate_incremental_by_partition(mocker: MockerFixture, make_snapshot,
30213023 snapshots = {},
30223024 )
30233025
3026+ # uses `replace_query` on first model execution
3027+ adapter_mock .replace_query .assert_called_once_with (
3028+ snapshot .table_name (),
3029+ model .render_query (),
3030+ partitioned_by = [
3031+ exp .to_column ("ds" , quoted = True ),
3032+ exp .to_column ("b" , quoted = True ),
3033+ ],
3034+ columns_to_types = model .columns_to_types ,
3035+ clustered_by = [],
3036+ table_properties = {},
3037+ column_descriptions = {},
3038+ partition_interval_unit = None ,
3039+ storage_format = None ,
3040+ table_description = None ,
3041+ table_format = None ,
3042+ )
3043+
3044+ adapter_mock .reset_mock ()
3045+ snapshot .intervals = [(to_timestamp ("2020-01-01" ), to_timestamp ("2020-01-02" ))]
3046+
3047+ evaluator .evaluate (
3048+ snapshot ,
3049+ start = "2020-01-02" ,
3050+ end = "2020-01-03" ,
3051+ execution_time = "2020-01-03" ,
3052+ snapshots = {},
3053+ )
3054+
3055+ # uses `insert_overwrite_by_partition` on all subsequent model executions
30243056 adapter_mock .insert_overwrite_by_partition .assert_called_once_with (
30253057 snapshot .table_name (),
30263058 model .render_query (),
0 commit comments