Skip to content

Commit 292569c

Browse files
fix adapter logic to handle expressions
1 parent c03d1f0 commit 292569c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

sqlmesh/core/engine_adapter/base.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,8 +1885,14 @@ def remove_managed_columns(
18851885
# they are equal or not, the extra check is not a problem and we gain simplified logic here.
18861886
# If we want to change this, then we just need to check the expressions in unique_key and pull out the
18871887
# column names and then remove them from the unmanaged_columns
1888-
if check_columns and check_columns == exp.Star():
1889-
check_columns = [exp.column(col) for col in unmanaged_columns_to_types]
1888+
if check_columns:
1889+
# Handle both Star directly and [Star()] (which can happen during serialization/deserialization)
1890+
if isinstance(check_columns, exp.Star) or (
1891+
isinstance(check_columns, list)
1892+
and len(check_columns) == 1
1893+
and isinstance(check_columns[0], exp.Star)
1894+
):
1895+
check_columns = [exp.column(col) for col in unmanaged_columns_to_types]
18901896
execution_ts = (
18911897
exp.cast(execution_time, time_data_type, dialect=self.dialect)
18921898
if isinstance(execution_time, exp.Column)
@@ -1923,7 +1929,8 @@ def remove_managed_columns(
19231929
col_qualified.set("table", exp.to_identifier("joined"))
19241930

19251931
t_col = col_qualified.copy()
1926-
t_col.this.set("this", f"t_{col.name}")
1932+
for column in t_col.find_all(exp.Column):
1933+
column.this.set("this", f"t_{column.name}")
19271934

19281935
row_check_conditions.extend(
19291936
[

0 commit comments

Comments
 (0)