Skip to content

Commit 3e66414

Browse files
committed
Improve parse error message
1 parent ab05c73 commit 3e66414

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

sqlmesh/core/renderer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ def _resolve_table(table: str | exp.Table) -> str:
251251
if not expressions:
252252
raise ConfigError(f"Failed to parse an expression:\n{self._expression}")
253253
except Exception as ex:
254-
raise ConfigError(f"Could not parse jinja at '{self._path}'.\n{ex}") from ex
254+
raise ConfigError(
255+
f"Could not parse the rendered jinja at '{self._path}'.\n{ex}"
256+
) from ex
255257

256258
if this_model:
257259
render_kwargs["this_model"] = this_model

tests/core/test_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8626,7 +8626,7 @@ def test_jinja_render_debug_logging(caplog):
86268626
model = load_sql_based_model(expressions)
86278627

86288628
# Attempt to render - this should fail due to invalid SQL syntax
8629-
with pytest.raises(ConfigError, match=r"Could not parse jinja"):
8629+
with pytest.raises(ConfigError, match=r"Could not parse the rendered jinja"):
86308630
model.render_query()
86318631

86328632
# Check that the rendered Jinja was logged

0 commit comments

Comments
 (0)