sqlmesh icon indicating copy to clipboard operation
sqlmesh copied to clipboard

SQLMesh project vars are not recognised in cli (plan) command

Open lafirm opened this issue 1 year ago • 2 comments

I have a model like this with a project varibale @schema_name, when I run sqlmesh plan lafir --select-model "@schema_name.test_model"

import pandas as pd

from sqlmesh import model


@model(
    "@schema_name.test_model",
    kind="FULL",
    columns={"id": "INT"},
)
def execute(*args, **kwargs):
    return pd.DataFrame([{"id": 1}])

the output is

No changes to plan: project files match the lafir environment

but when I directly put the value of schema_name like this sqlmesh plan lafir --select-model "test_schema.test_model", it works and I'm getting the desired output

Differences from the lafir environment:

Requirements:

  • pandas==2.2.3 Models: └── Added: └── test_schema.test_model__lafir Models needing backfill (missing dates): └── test_schema.test_model__lafir: 2020-03-09 - 2025-01-26

lafirm avatar Jan 27 '25 12:01 lafirm

Hey @lafirm, this behavior is expected today: variables aren't supported within these CLI flags. Instead, you can use basic regex and some other rules that are described in this page.

Closing this for now, but happy to continue discussing and/or reopen if needed.

georgesittas avatar Jan 27 '25 22:01 georgesittas

Hey @lafirm, this behavior is expected today: variables aren't supported within these CLI flags. Instead, you can use basic regex and some other rules that are described in this page.

Closing this for now, but happy to continue discussing and/or reopen if needed.

alright! thanks @georgesittas for the update. But isn't it appropriate to output that the variables are not supported when we use that in the CLI flags, instead of giving a false output that there are no changes?

lafirm avatar Jan 28 '25 05:01 lafirm