sqlmesh icon indicating copy to clipboard operation
sqlmesh copied to clipboard

grains with fake column not throwing any error or warning

Open lafirm opened this issue 1 year ago • 1 comments

I recently changed a column name in one of my SQLMesh model which was actually used as a grain as well, the model executed successfully without throwing any errors or warning when I missed to update the column name in grains. I expect that this should in some way tells us that the column name in the grains is not valid.

Using SQLMesh version = 0.144.0

A reproducible example:

import pandas as pd

from sqlmesh import model


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

lafirm avatar Jan 16 '25 14:01 lafirm

The grain and grains attributes are only used for the table_diff command right now, so we intentionally don't enforce any constraints on them today.

I'm gonna close this issue for now, but happy to continue discussing.

georgesittas avatar Jan 16 '25 16:01 georgesittas