|
51 | 51 |
|
52 | 52 | if t.TYPE_CHECKING: |
53 | 53 | import pandas as pd |
| 54 | + from pandas.core.frame import _PandasNamedTuple |
54 | 55 |
|
55 | 56 | from sqlmesh.core._typing import SchemaName, SessionProperties, TableName |
56 | 57 | from sqlmesh.core.engine_adapter._typing import ( |
@@ -262,7 +263,7 @@ def _df_to_source_queries( |
262 | 263 | SourceQuery( |
263 | 264 | query_factory=partial( |
264 | 265 | self._values_to_sql, |
265 | | - values=values, # type: ignore |
| 266 | + values=values, |
266 | 267 | columns_to_types=columns_to_types, |
267 | 268 | batch_start=i, |
268 | 269 | batch_end=min(i + batch_size, num_rows), |
@@ -1021,9 +1022,7 @@ def create_view( |
1021 | 1022 | query_or_df = self._native_df_to_pandas_df(query_or_df) |
1022 | 1023 |
|
1023 | 1024 | if isinstance(query_or_df, pd.DataFrame): |
1024 | | - values: t.List[t.Tuple[t.Any, ...]] = list( |
1025 | | - query_or_df.itertuples(index=False, name=None) |
1026 | | - ) |
| 1025 | + values = list(query_or_df.itertuples(index=False, name=None)) |
1027 | 1026 | columns_to_types = columns_to_types or self._columns_to_types(query_or_df) |
1028 | 1027 | if not columns_to_types: |
1029 | 1028 | raise SQLMeshError("columns_to_types must be provided for dataframes") |
@@ -1343,7 +1342,7 @@ def _insert_overwrite_by_time_partition( |
1343 | 1342 |
|
1344 | 1343 | def _values_to_sql( |
1345 | 1344 | self, |
1346 | | - values: t.List[t.Tuple[t.Any, ...]], |
| 1345 | + values: t.List[_PandasNamedTuple], |
1347 | 1346 | columns_to_types: t.Dict[str, exp.DataType], |
1348 | 1347 | batch_start: int, |
1349 | 1348 | batch_end: int, |
|
0 commit comments