Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sqlmesh/core/model/definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -2431,7 +2431,7 @@ def _create_model(
if not issubclass(klass, SqlModel):
defaults.pop("optimize_query", None)

statements = []
statements: t.List[t.Union[exp.Expression, t.Tuple[exp.Expression, bool]]] = []

if "pre_statements" in kwargs:
statements.extend(kwargs["pre_statements"])
Expand All @@ -2453,7 +2453,7 @@ def _create_model(
statements.extend(property_values.expressions)

jinja_macro_references, used_variables = extract_macro_references_and_variables(
*(gen(e) for e in statements)
*(gen(e if isinstance(e, exp.Expression) else e[0]) for e in statements)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure this is a non-breaking change?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be fine, I think. These generated strings are used for extracting macro & variable references. If I'm not mistaken, we'd previously produce "(True, <expression SQL>)" due to reaching this section. After this PR we'll only search <expression SQL>.

)

if jinja_macros:
Expand Down