File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -247,11 +247,15 @@ def _column_descriptions_validator(
247247
248248 columns_to_types = info .data .get ("columns_to_types_" )
249249 if columns_to_types :
250- for column_name in col_descriptions :
250+ from sqlmesh .core .console import get_console
251+
252+ console = get_console ()
253+ for column_name in list (col_descriptions ):
251254 if column_name not in columns_to_types :
252- raise ConfigError (
255+ console . log_warning (
253256 f"In model '{ info .data ['name' ]} ', a description is provided for column '{ column_name } ' but it is not a column in the model."
254257 )
258+ del col_descriptions [column_name ]
255259
256260 return col_descriptions
257261
Original file line number Diff line number Diff line change @@ -2934,11 +2934,16 @@ def a_model(context):
29342934 def b_model (context ):
29352935 pass
29362936
2937- with pytest . raises ( ConfigError , match = "a description is provided for column 'COL'" ) :
2937+ with patch . object ( get_console (), "log_warning" ) as mock_logger :
29382938 py_model = model .get_registry ()["col_descriptions_quoted" ].model (
29392939 module_path = Path ("." ),
29402940 path = Path ("." ),
29412941 )
2942+ assert '"COL"' not in py_model .column_descriptions
2943+ assert (
2944+ mock_logger .mock_calls [0 ].args [0 ]
2945+ == "In model 'col_descriptions_quoted', a description is provided for column 'COL' but it is not a column in the model."
2946+ )
29422947
29432948
29442949def test_python_model_unsupported_kind () -> None :
You can’t perform that action at this time.
0 commit comments