Skip to content

Commit 94bd87e

Browse files
committed
fix: Remove replace as a public function for the Transaction and Table classes
1 parent f12fa5d commit 94bd87e

File tree

1 file changed

+0
-53
lines changed

1 file changed

+0
-53
lines changed

pyiceberg/table/__init__.py

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -450,32 +450,6 @@ def update_statistics(self) -> UpdateStatistics:
450450
"""
451451
return UpdateStatistics(transaction=self)
452452

453-
def replace(
454-
self,
455-
files_to_delete: Iterable[DataFile],
456-
files_to_add: Iterable[DataFile],
457-
snapshot_properties: dict[str, str] = EMPTY_DICT,
458-
branch: str | None = MAIN_BRANCH,
459-
) -> None:
460-
"""
461-
Shorthand for replacing existing files with new files.
462-
463-
A replace will produce a REPLACE snapshot that will ignore existing
464-
files and replace them with the new files.
465-
466-
Args:
467-
files_to_delete: The files to delete
468-
files_to_add: The new files to add that replace the deleted files
469-
snapshot_properties: Custom properties to be added to the snapshot summary
470-
branch: Branch Reference to run the replace operation
471-
"""
472-
with self.update_snapshot(snapshot_properties=snapshot_properties, branch=branch).replace() as replace_snapshot:
473-
for file_to_delete in files_to_delete:
474-
replace_snapshot.delete_data_file(file_to_delete)
475-
476-
for data_file in files_to_add:
477-
replace_snapshot.append_data_file(data_file)
478-
479453
def append(self, df: pa.Table, snapshot_properties: dict[str, str] = EMPTY_DICT, branch: str | None = MAIN_BRANCH) -> None:
480454
"""
481455
Shorthand API for appending a PyArrow table to a table transaction.
@@ -1410,33 +1384,6 @@ def append(self, df: pa.Table, snapshot_properties: dict[str, str] = EMPTY_DICT,
14101384
with self.transaction() as tx:
14111385
tx.append(df=df, snapshot_properties=snapshot_properties, branch=branch)
14121386

1413-
def replace(
1414-
self,
1415-
files_to_delete: Iterable[DataFile],
1416-
files_to_add: Iterable[DataFile],
1417-
snapshot_properties: dict[str, str] = EMPTY_DICT,
1418-
branch: str | None = MAIN_BRANCH,
1419-
) -> None:
1420-
"""
1421-
Shorthand for replacing existing files with new files.
1422-
1423-
A replace will produce a REPLACE snapshot that will ignore existing
1424-
files and replace them with the new files.
1425-
1426-
Args:
1427-
files_to_delete: The files to delete
1428-
files_to_add: The new files to add that replace the deleted files
1429-
snapshot_properties: Custom properties to be added to the snapshot summary
1430-
branch: Branch Reference to run the replace operation
1431-
"""
1432-
with self.transaction() as tx:
1433-
tx.replace(
1434-
files_to_delete=files_to_delete,
1435-
files_to_add=files_to_add,
1436-
snapshot_properties=snapshot_properties,
1437-
branch=branch,
1438-
)
1439-
14401387
def dynamic_partition_overwrite(
14411388
self, df: pa.Table, snapshot_properties: dict[str, str] = EMPTY_DICT, branch: str | None = MAIN_BRANCH
14421389
) -> None:

0 commit comments

Comments
 (0)