diff --git a/python/deltalake/_internal.pyi b/python/deltalake/_internal.pyi index 908a3d7807..b6e0af3304 100644 --- a/python/deltalake/_internal.pyi +++ b/python/deltalake/_internal.pyi @@ -48,9 +48,6 @@ class RawDeltaTable: def protocol_versions(self) -> List[Any]: ... def load_version(self, version: int) -> None: ... def load_with_datetime(self, ds: str) -> None: ... - def files_by_partitions( - self, partitions_filters: Optional[FilterType] - ) -> List[str]: ... def files(self, partition_filters: Optional[FilterType]) -> List[str]: ... def file_uris(self, partition_filters: Optional[FilterType]) -> List[str]: ... def vacuum( diff --git a/python/deltalake/table.py b/python/deltalake/table.py index bee0810382..18291467cc 100644 --- a/python/deltalake/table.py +++ b/python/deltalake/table.py @@ -700,12 +700,18 @@ def schema(self) -> DeltaSchema: """ return self._table.schema - def files_by_partitions(self, partition_filters: Optional[FilterType]) -> List[str]: + def files_by_partitions(self, partition_filters: FilterType) -> List[str]: """ Get the files for each partition """ - return self._table.files_by_partitions(partition_filters) + warnings.warn( + "files_by_partitions is deprecated, please use DeltaTable.files() instead.", + category=DeprecationWarning, + stacklevel=2, + ) + + return self.files(partition_filters) # type: ignore def metadata(self) -> Metadata: """ diff --git a/python/src/lib.rs b/python/src/lib.rs index 2d6ce42952..63d0bcc17d 100644 --- a/python/src/lib.rs +++ b/python/src/lib.rs @@ -270,26 +270,6 @@ impl RawDeltaTable { }) } - pub fn files_by_partitions( - &self, - py: Python, - partitions_filters: Vec<(PyBackedStr, PyBackedStr, PartitionFilterValue)>, - ) -> PyResult> { - py.allow_threads(|| { - let partition_filters = convert_partition_filters(partitions_filters); - match partition_filters { - Ok(filters) => Ok(self - ._table - .get_files_by_partitions(&filters) - .map_err(PythonError::from)? - .into_iter() - .map(|p| p.to_string()) - .collect()), - Err(err) => Err(PythonError::from(err).into()), - } - }) - } - pub fn files( &self, py: Python, @@ -961,7 +941,7 @@ impl RawDeltaTable { ) -> PyResult>)>> { let path_set = match partition_filters { Some(filters) => Some(HashSet::<_>::from_iter( - self.files_by_partitions(py, filters)?.iter().cloned(), + self.files(py, Some(filters))?.iter().cloned(), )), None => None, };