@@ -1512,6 +1512,44 @@ def test_run_with_select_models(
15121512 }
15131513
15141514
1515+ @time_machine .travel ("2023-01-08 15:00:00 UTC" )
1516+ def test_plan_with_run (
1517+ init_and_plan_context : t .Callable ,
1518+ ):
1519+ context , plan = init_and_plan_context ("examples/sushi" )
1520+ context .apply (plan )
1521+
1522+ model = context .get_model ("sushi.waiter_revenue_by_day" )
1523+ context .upsert_model (add_projection_to_model (t .cast (SqlModel , model )))
1524+
1525+ with time_machine .travel ("2023-01-09 00:00:00 UTC" ):
1526+ plan = context .plan (run = True )
1527+ assert plan .has_changes
1528+ assert plan .missing_intervals
1529+
1530+ context .apply (plan )
1531+
1532+ snapshots = context .state_sync .state_sync .get_snapshots (context .snapshots .values ())
1533+ assert {s .name : s .intervals [0 ][1 ] for s in snapshots .values () if s .intervals } == {
1534+ '"memory"."sushi"."waiter_revenue_by_day"' : to_timestamp ("2023-01-09" ),
1535+ '"memory"."sushi"."order_items"' : to_timestamp ("2023-01-09" ),
1536+ '"memory"."sushi"."orders"' : to_timestamp ("2023-01-09" ),
1537+ '"memory"."sushi"."items"' : to_timestamp ("2023-01-09" ),
1538+ '"memory"."sushi"."customer_revenue_lifetime"' : to_timestamp ("2023-01-09" ),
1539+ '"memory"."sushi"."customer_revenue_by_day"' : to_timestamp ("2023-01-09" ),
1540+ '"memory"."sushi"."latest_order"' : to_timestamp ("2023-01-09" ),
1541+ '"memory"."sushi"."waiter_names"' : to_timestamp ("2023-01-08" ),
1542+ '"memory"."sushi"."raw_marketing"' : to_timestamp ("2023-01-09" ),
1543+ '"memory"."sushi"."marketing"' : to_timestamp ("2023-01-09" ),
1544+ '"memory"."sushi"."waiter_as_customer_by_day"' : to_timestamp ("2023-01-09" ),
1545+ '"memory"."sushi"."top_waiters"' : to_timestamp ("2023-01-09" ),
1546+ '"memory"."raw"."demographics"' : to_timestamp ("2023-01-09" ),
1547+ "assert_item_price_above_zero" : to_timestamp ("2023-01-09" ),
1548+ '"memory"."sushi"."active_customers"' : to_timestamp ("2023-01-09" ),
1549+ '"memory"."sushi"."customers"' : to_timestamp ("2023-01-09" ),
1550+ }
1551+
1552+
15151553@time_machine .travel ("2023-01-08 15:00:00 UTC" )
15161554def test_run_with_select_models_no_auto_upstream (
15171555 init_and_plan_context : t .Callable ,
0 commit comments