Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sqlmesh/core/plan/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ def should_force_rebuild(old: Snapshot, new: Snapshot) -> bool:


def is_breaking_kind_change(old: Snapshot, new: Snapshot) -> bool:
if new.is_model != old.is_model:
# If one is a model and the other isn't, then we need to rebuild
return True
if not new.is_model or not old.is_model:
# If neither are models, then we don't need to rebuild
return False
Comment thread
izeigerman marked this conversation as resolved.
if old.virtual_environment_mode != new.virtual_environment_mode:
# If the virtual environment mode has changed, then we need to rebuild
return True
Expand Down
27 changes: 26 additions & 1 deletion tests/core/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3116,7 +3116,32 @@ def test_virtual_environment_mode_dev_only_model_change_downstream_of_seed(

# Make sure there's no error when applying the plan
context.apply(plan)
context.plan("prod", auto_apply=True, no_prompts=True)


@time_machine.travel("2023-01-08 15:00:00 UTC")
def test_virtual_environment_mode_dev_only_model_change_standalone_audit(
init_and_plan_context: t.Callable,
):
context, plan = init_and_plan_context(
"examples/sushi", config="test_config_virtual_environment_mode_dev_only"
)
context.apply(plan)

# Change a model upstream from a standalone audit
model = context.get_model("sushi.items")
model = model.copy(update={"stamp": "force new version"})
context.upsert_model(model)

plan = context.plan_builder("prod", skip_tests=True).build()

# Make sure the standalone audit is among modified
assert (
context.get_snapshot("assert_item_price_above_zero").snapshot_id
in plan.indirectly_modified[context.get_snapshot("sushi.items").snapshot_id]
)

# Make sure there's no error when applying the plan
context.apply(plan)


@time_machine.travel("2023-01-08 15:00:00 UTC")
Expand Down
Loading