Skip to content

Commit 81b445a

Browse files
committed
Fix: bug in model creation related to metadata-only statements
1 parent e07c5fe commit 81b445a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sqlmesh/core/model/definition.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,7 +2431,7 @@ def _create_model(
24312431
if not issubclass(klass, SqlModel):
24322432
defaults.pop("optimize_query", None)
24332433

2434-
statements = []
2434+
statements: t.List[t.Union[exp.Expression, t.Tuple[exp.Expression, bool]]] = []
24352435

24362436
if "pre_statements" in kwargs:
24372437
statements.extend(kwargs["pre_statements"])
@@ -2453,7 +2453,7 @@ def _create_model(
24532453
statements.extend(property_values.expressions)
24542454

24552455
jinja_macro_references, used_variables = extract_macro_references_and_variables(
2456-
*(gen(e) for e in statements)
2456+
*(gen(e if isinstance(e, exp.Expression) else e[0]) for e in statements)
24572457
)
24582458

24592459
if jinja_macros:

0 commit comments

Comments
 (0)