diff --git a/datapipe/meta/sql_meta.py b/datapipe/meta/sql_meta.py index 7374226e..db03c0bb 100644 --- a/datapipe/meta/sql_meta.py +++ b/datapipe/meta/sql_meta.py @@ -234,7 +234,7 @@ def get_existing_idx(self, idx: Optional[IndexDF] = None) -> IndexDF: # Empty index -> empty result return cast( IndexDF, - pd.DataFrame(columns=[column.name for column in self.sql_schema]), # type: ignore + pd.DataFrame(columns=self.primary_keys), # type: ignore ) idx_cols = list(set(idx.columns.tolist()) & set(self.primary_keys)) else: