Skip to content

Plan --select-model doesn't allow adding unmodified models to an existing dev environment #5497

@xardasos

Description

@xardasos

plan --select-model A dev creates a dev environment, even if there are no changes to the selected model compared to prod. However, it is not possible to add an unmodified model B to the existing environment dev with plan --select-model B dev. I'm unsure whether this is intended.

How to reproduce

Execute the following commands (demo duckdb project):

  1. sqlmesh init
  2. sqlmesh plan
  3. sqlmesh plan --select-model sqlmesh_example.incremental_model dev
  4. sqlmesh plan --select-model sqlmesh_example.incremental_model --select-model sqlmesh_example.full_model dev

Current behavior

Step 4. results in

No changes to plan: project files match the dev environment

Expected behavior

Model sqlmesh_example.full_model gets added to the dev virtual environment.

Notes

  1. Adding unmodified models to an existing virtual environment can be useful, I think (e.g. when working with pinned_environments or for testing purposes).
  2. If step 3. is omitted, the dev environment will be created with both models sqlmesh_example.incremental_model and sqlmesh_example.full_model. So, one possible workaround is to create a new virtual environment instead of updating the old one.

Sqlmesh version

0.224.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions