Skip to content

Commit 7a7b452

Browse files
committed
Fix: Columns should be sourced from the target table and not the temporary merge table (#4191)
1 parent d123712 commit 7a7b452

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

sqlmesh/core/engine_adapter/bigquery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ def insert_overwrite_by_partition(
608608
if columns_to_types is None or columns_to_types[
609609
partition_column.name
610610
] == exp.DataType.build("unknown"):
611-
columns_to_types = self.columns(temp_table_name)
611+
columns_to_types = self.columns(table_name)
612612

613613
partition_type_sql = columns_to_types[partition_column.name].sql(dialect=self.dialect)
614614

tests/core/engine_adapter/test_bigquery.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ def test_insert_overwrite_by_partition_query_unknown_column_types(
116116
},
117117
)
118118

119-
columns_mock.assert_called_once_with(
120-
exp.to_table(f"test_schema.__temp_test_table_{temp_table_id}")
121-
)
119+
columns_mock.assert_called_once_with(table_name)
122120

123121
sql_calls = _to_sql_calls(execute_mock)
124122
assert sql_calls == [

0 commit comments

Comments
 (0)