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 @@ -2925,7 +2925,8 @@ def a_model(context):
29252925
29262926 assert py_model .columns_to_types .keys () == py_model .column_descriptions .keys ()
29272927
2928- # error: `columns` and `column_descriptions` column names are different cases, quoting preserves case
2928+ # warning: `columns` and `column_descriptions` column names are quoted and different cases,
2929+ # so column not present in model
29292930 @model (
29302931 "col_descriptions_quoted" ,
29312932 columns = {'"col"' : "int" },
@@ -2934,11 +2935,13 @@ def a_model(context):
29342935 def b_model (context ):
29352936 pass
29362937
2937- with pytest . raises ( ConfigError , match = "a description is provided for column 'COL'" ) :
2938+ with patch . object ( get_console (), "log_warning" ) as mock_logger :
29382939 py_model = model .get_registry ()["col_descriptions_quoted" ].model (
29392940 module_path = Path ("." ),
29402941 path = Path ("." ),
29412942 )
2943+ assert mock_logger .call_count == 1
2944+ assert "a description is provided for column 'COL'" in mock_logger .call_args [0 ][0 ]
29422945
29432946
29442947def test_python_model_unsupported_kind () -> None :
You can’t perform that action at this time.
0 commit comments