@@ -488,12 +488,6 @@ def test_full_history_restatement_model_regular_plan_preview_enabled(
488488 waiter_as_customer_snapshot = context .get_snapshot (
489489 "sushi.waiter_as_customer_by_day" , raise_if_missing = True
490490 )
491- count_customers_active_snapshot = context .get_snapshot (
492- "sushi.count_customers_active" , raise_if_missing = True
493- )
494- count_customers_inactive_snapshot = context .get_snapshot (
495- "sushi.count_customers_inactive" , raise_if_missing = True
496- )
497491
498492 plan = context .plan_builder ("dev" , skip_tests = True , enable_preview = True ).build ()
499493
@@ -1461,6 +1455,18 @@ def test_indirect_non_breaking_downstream_of_forward_only(init_and_plan_context:
14611455 plan = context .plan_builder ("prod" , skip_tests = True ).build ()
14621456 assert plan .start == to_timestamp ("2023-01-01" )
14631457 assert plan .missing_intervals == [
1458+ SnapshotIntervals (
1459+ snapshot_id = top_waiter_snapshot .snapshot_id ,
1460+ intervals = [
1461+ (to_timestamp ("2023-01-01" ), to_timestamp ("2023-01-02" )),
1462+ (to_timestamp ("2023-01-02" ), to_timestamp ("2023-01-03" )),
1463+ (to_timestamp ("2023-01-03" ), to_timestamp ("2023-01-04" )),
1464+ (to_timestamp ("2023-01-04" ), to_timestamp ("2023-01-05" )),
1465+ (to_timestamp ("2023-01-05" ), to_timestamp ("2023-01-06" )),
1466+ (to_timestamp ("2023-01-06" ), to_timestamp ("2023-01-07" )),
1467+ (to_timestamp ("2023-01-07" ), to_timestamp ("2023-01-08" )),
1468+ ],
1469+ ),
14641470 SnapshotIntervals (
14651471 snapshot_id = non_breaking_snapshot .snapshot_id ,
14661472 intervals = [
@@ -1485,8 +1491,9 @@ def test_indirect_non_breaking_downstream_of_forward_only(init_and_plan_context:
14851491
14861492@time_machine .travel ("2023-01-08 15:00:00 UTC" )
14871493def test_breaking_only_impacts_immediate_children (init_and_plan_context : t .Callable ):
1488- context , plan = init_and_plan_context ("examples/sushi" )
1489- context .apply (plan )
1494+ context , _ = init_and_plan_context ("examples/sushi" )
1495+ context .upsert_model (context .get_model ("sushi.top_waiters" ).copy (update = {"kind" : FullKind ()}))
1496+ context .plan ("prod" , skip_tests = True , auto_apply = True , no_prompts = True )
14901497
14911498 breaking_model = context .get_model ("sushi.orders" )
14921499 breaking_model = breaking_model .copy (update = {"stamp" : "force new version" })
@@ -2206,9 +2213,7 @@ def test_indirect_non_breaking_view_model_non_representative_snapshot(
22062213 context .upsert_model (add_projection_to_model (t .cast (SqlModel , forward_only_model )))
22072214 forward_only_model_snapshot_id = context .get_snapshot (forward_only_model_name ).snapshot_id
22082215 full_downstream_model_snapshot_id = context .get_snapshot (full_downstream_model_name ).snapshot_id
2209- full_downstream_model_2_snapshot_id = context .get_snapshot (
2210- view_downstream_model_name
2211- ).snapshot_id
2216+ view_downstream_model_snapshot_id = context .get_snapshot (view_downstream_model_name ).snapshot_id
22122217 dev_plan = context .plan ("dev" , auto_apply = True , no_prompts = True , enable_preview = False )
22132218 assert (
22142219 dev_plan .snapshots [forward_only_model_snapshot_id ].change_category
@@ -2219,7 +2224,7 @@ def test_indirect_non_breaking_view_model_non_representative_snapshot(
22192224 == SnapshotChangeCategory .INDIRECT_NON_BREAKING
22202225 )
22212226 assert (
2222- dev_plan .snapshots [full_downstream_model_2_snapshot_id ].change_category
2227+ dev_plan .snapshots [view_downstream_model_snapshot_id ].change_category
22232228 == SnapshotChangeCategory .INDIRECT_NON_BREAKING
22242229 )
22252230 assert not dev_plan .missing_intervals
@@ -2238,9 +2243,7 @@ def test_indirect_non_breaking_view_model_non_representative_snapshot(
22382243 new_full_downstream_model = load_sql_based_model (new_full_downstream_model_expressions )
22392244 context .upsert_model (new_full_downstream_model )
22402245 full_downstream_model_snapshot_id = context .get_snapshot (full_downstream_model_name ).snapshot_id
2241- full_downstream_model_2_snapshot_id = context .get_snapshot (
2242- view_downstream_model_name
2243- ).snapshot_id
2246+ view_downstream_model_snapshot_id = context .get_snapshot (view_downstream_model_name ).snapshot_id
22442247 dev_plan = context .plan (
22452248 "dev" ,
22462249 categorizer_config = CategorizerConfig .all_full (),
@@ -2253,12 +2256,12 @@ def test_indirect_non_breaking_view_model_non_representative_snapshot(
22532256 == SnapshotChangeCategory .BREAKING
22542257 )
22552258 assert (
2256- dev_plan .snapshots [full_downstream_model_2_snapshot_id ].change_category
2259+ dev_plan .snapshots [view_downstream_model_snapshot_id ].change_category
22572260 == SnapshotChangeCategory .INDIRECT_BREAKING
22582261 )
22592262 assert len (dev_plan .missing_intervals ) == 2
22602263 assert dev_plan .missing_intervals [0 ].snapshot_id == full_downstream_model_snapshot_id
2261- assert dev_plan .missing_intervals [1 ].snapshot_id == full_downstream_model_2_snapshot_id
2264+ assert dev_plan .missing_intervals [1 ].snapshot_id == view_downstream_model_snapshot_id
22622265
22632266 # Check that the representative view hasn't been created yet.
22642267 assert not context .engine_adapter .table_exists (
@@ -2272,9 +2275,7 @@ def test_indirect_non_breaking_view_model_non_representative_snapshot(
22722275 # Finally, make a non-breaking change to the full model in the same dev environment.
22732276 context .upsert_model (add_projection_to_model (t .cast (SqlModel , new_full_downstream_model )))
22742277 full_downstream_model_snapshot_id = context .get_snapshot (full_downstream_model_name ).snapshot_id
2275- full_downstream_model_2_snapshot_id = context .get_snapshot (
2276- view_downstream_model_name
2277- ).snapshot_id
2278+ view_downstream_model_snapshot_id = context .get_snapshot (view_downstream_model_name ).snapshot_id
22782279 dev_plan = context .plan (
22792280 "dev" ,
22802281 categorizer_config = CategorizerConfig .all_full (),
@@ -2287,10 +2288,13 @@ def test_indirect_non_breaking_view_model_non_representative_snapshot(
22872288 == SnapshotChangeCategory .NON_BREAKING
22882289 )
22892290 assert (
2290- dev_plan .snapshots [full_downstream_model_2_snapshot_id ].change_category
2291+ dev_plan .snapshots [view_downstream_model_snapshot_id ].change_category
22912292 == SnapshotChangeCategory .INDIRECT_NON_BREAKING
22922293 )
22932294
2295+ # Deploy changes to prod
2296+ context .plan ("prod" , auto_apply = True , no_prompts = True )
2297+
22942298 # Check that the representative view has been created.
22952299 assert context .engine_adapter .table_exists (
22962300 context .get_snapshot (view_downstream_model_name ).table_name ()
0 commit comments