@@ -335,6 +335,66 @@ def test_forward_only_model_regular_plan_preview_enabled(init_and_plan_context:
335335 assert dev_df ["event_date" ].tolist () == [pd .to_datetime ("2023-01-07" )]
336336
337337
338+ @freeze_time ("2023-01-08 15:00:00" )
339+ def test_full_history_restatement_model_regular_plan_preview_enabled (
340+ init_and_plan_context : t .Callable ,
341+ ):
342+ context , plan = init_and_plan_context ("examples/sushi" )
343+ context .apply (plan )
344+
345+ model_name = "sushi.marketing" # SCD2 model
346+
347+ model = context .get_model (model_name )
348+ model = add_projection_to_model (t .cast (SqlModel , model ))
349+
350+ context .upsert_model (model )
351+ snapshot = context .get_snapshot (model , raise_if_missing = True )
352+ customers_snapshot = context .get_snapshot ("sushi.customers" , raise_if_missing = True )
353+ waiter_as_customer_snapshot = context .get_snapshot (
354+ "sushi.waiter_as_customer_by_day" , raise_if_missing = True
355+ )
356+
357+ plan = context .plan ("dev" , no_prompts = True , skip_tests = True , enable_preview = True )
358+
359+ assert len (plan .new_snapshots ) == 3
360+ assert (
361+ plan .context_diff .snapshots [snapshot .snapshot_id ].change_category
362+ == SnapshotChangeCategory .FORWARD_ONLY
363+ )
364+ assert (
365+ plan .context_diff .snapshots [customers_snapshot .snapshot_id ].change_category
366+ == SnapshotChangeCategory .FORWARD_ONLY
367+ )
368+ assert (
369+ plan .context_diff .snapshots [waiter_as_customer_snapshot .snapshot_id ].change_category
370+ == SnapshotChangeCategory .FORWARD_ONLY
371+ )
372+
373+ assert plan .start == to_date ("2023-01-07" )
374+ assert plan .missing_intervals == [
375+ SnapshotIntervals (
376+ snapshot_id = customers_snapshot .snapshot_id ,
377+ intervals = [
378+ (to_timestamp ("2023-01-07" ), to_timestamp ("2023-01-08" )),
379+ ],
380+ ),
381+ SnapshotIntervals (
382+ snapshot_id = snapshot .snapshot_id ,
383+ intervals = [
384+ (to_timestamp ("2023-01-07" ), to_timestamp ("2023-01-08" )),
385+ ],
386+ ),
387+ SnapshotIntervals (
388+ snapshot_id = waiter_as_customer_snapshot .snapshot_id ,
389+ intervals = [
390+ (to_timestamp ("2023-01-07" ), to_timestamp ("2023-01-08" )),
391+ ],
392+ ),
393+ ]
394+
395+ context .apply (plan )
396+
397+
338398@freeze_time ("2023-01-08 15:00:00" )
339399def test_hourly_model_with_lookback_no_backfill_in_dev (init_and_plan_context : t .Callable ):
340400 context , plan = init_and_plan_context ("examples/sushi" )
0 commit comments