File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed
Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 55
66def should_force_rebuild (old : Snapshot , new : Snapshot ) -> bool :
77 if new .is_view and new .is_indirect_non_breaking and not new .is_forward_only :
8- # View models always need to be rebuilt to reflect updated upstream dependencies.
8+ # View models always need to be rebuilt to reflect updated upstream dependencies
9+ return True
10+ if new .is_seed :
11+ # Seed models always need to be rebuilt to reflect changes in the seed file
912 return True
1013 return is_breaking_kind_change (old , new )
1114
Original file line number Diff line number Diff line change @@ -2918,6 +2918,37 @@ def test_virtual_environment_mode_dev_only_model_kind_change_manual_categorizati
29182918 ]
29192919
29202920
2921+ @time_machine .travel ("2023-01-08 15:00:00 UTC" )
2922+ def test_virtual_environment_mode_dev_only_seed_model_change (
2923+ init_and_plan_context : t .Callable ,
2924+ ):
2925+ context , plan = init_and_plan_context (
2926+ "examples/sushi" , config = "test_config_virtual_environment_mode_dev_only"
2927+ )
2928+ context .apply (plan )
2929+
2930+ seed_model = context .get_model ("sushi.waiter_names" )
2931+ with open (seed_model .seed_path , "a" ) as fd :
2932+ fd .write ("\n 123,New Test Name" )
2933+
2934+ context .load ()
2935+ seed_model_snapshot = context .get_snapshot ("sushi.waiter_names" )
2936+ plan = context .plan_builder ("prod" ).build ()
2937+ assert plan .directly_modified == {seed_model_snapshot .snapshot_id }
2938+ assert len (plan .missing_intervals ) == 1
2939+ assert plan .missing_intervals [0 ].snapshot_id == seed_model_snapshot .snapshot_id
2940+
2941+ context .apply (plan )
2942+
2943+ actual_seed_df = context .fetchdf ("SELECT * FROM sushi.waiter_names WHERE id = 123" )
2944+ assert actual_seed_df .to_dict ("records" ) == [
2945+ {
2946+ "id" : 123 ,
2947+ "name" : "New Test Name" ,
2948+ }
2949+ ]
2950+
2951+
29212952@time_machine .travel ("2023-01-08 15:00:00 UTC" )
29222953def test_restatement_plan_ignores_changes (init_and_plan_context : t .Callable ):
29232954 context , plan = init_and_plan_context ("examples/sushi" )
You can’t perform that action at this time.
0 commit comments