File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,9 @@ def _column_descriptions_validator(
249249 if columns_to_types :
250250 for column_name in col_descriptions :
251251 if column_name not in columns_to_types :
252- raise ConfigError (
252+ from sqlmesh .core .console import get_console
253+
254+ get_console ().log_warning (
253255 f"In model '{ info .data ['name' ]} ', a description is provided for column '{ column_name } ' but it is not a column in the model."
254256 )
255257
Original file line number Diff line number Diff line change @@ -2907,7 +2907,8 @@ def a_model(context):
29072907
29082908 assert py_model .columns_to_types .keys () == py_model .column_descriptions .keys ()
29092909
2910- # error: `columns` and `column_descriptions` column names are different cases, quoting preserves case
2910+ # warning: `columns` and `column_descriptions` column names are quoted and different cases,
2911+ # so column not present in model
29112912 @model (
29122913 "col_descriptions_quoted" ,
29132914 columns = {'"col"' : "int" },
@@ -2916,11 +2917,13 @@ def a_model(context):
29162917 def b_model (context ):
29172918 pass
29182919
2919- with pytest . raises ( ConfigError , match = "a description is provided for column 'COL'" ) :
2920+ with patch . object ( get_console (), "log_warning" ) as mock_logger :
29202921 py_model = model .get_registry ()["col_descriptions_quoted" ].model (
29212922 module_path = Path ("." ),
29222923 path = Path ("." ),
29232924 )
2925+ assert mock_logger .call_count == 1
2926+ assert "a description is provided for column 'COL'" in mock_logger .call_args [0 ][0 ]
29242927
29252928
29262929def test_python_model_unsupported_kind () -> None :
You can’t perform that action at this time.
0 commit comments