From 6c5ac3f7b99f9c7b5405ef1a2f7313af9a83fa49 Mon Sep 17 00:00:00 2001 From: George Sittas Date: Thu, 11 Sep 2025 16:25:50 +0300 Subject: [PATCH] Chore: make `column_descriptions` validation more lenient --- sqlmesh/core/model/meta.py | 8 ++++++-- tests/core/test_model.py | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/sqlmesh/core/model/meta.py b/sqlmesh/core/model/meta.py index 11e384b813..9208fbdbb5 100644 --- a/sqlmesh/core/model/meta.py +++ b/sqlmesh/core/model/meta.py @@ -247,11 +247,15 @@ def _column_descriptions_validator( columns_to_types = info.data.get("columns_to_types_") if columns_to_types: - for column_name in col_descriptions: + from sqlmesh.core.console import get_console + + console = get_console() + for column_name in list(col_descriptions): if column_name not in columns_to_types: - raise ConfigError( + console.log_warning( f"In model '{info.data['name']}', a description is provided for column '{column_name}' but it is not a column in the model." ) + del col_descriptions[column_name] return col_descriptions diff --git a/tests/core/test_model.py b/tests/core/test_model.py index a252418a79..1511e37c53 100644 --- a/tests/core/test_model.py +++ b/tests/core/test_model.py @@ -2934,11 +2934,16 @@ def a_model(context): def b_model(context): pass - with pytest.raises(ConfigError, match="a description is provided for column 'COL'"): + with patch.object(get_console(), "log_warning") as mock_logger: py_model = model.get_registry()["col_descriptions_quoted"].model( module_path=Path("."), path=Path("."), ) + assert '"COL"' not in py_model.column_descriptions + assert ( + mock_logger.mock_calls[0].args[0] + == "In model 'col_descriptions_quoted', a description is provided for column 'COL' but it is not a column in the model." + ) def test_python_model_unsupported_kind() -> None: