Skip to content

Commit 32e1e85

Browse files
committed
Revert changes (moved to #1598)
1 parent 19e17f0 commit 32e1e85

File tree

2 files changed

+0
-77
lines changed

2 files changed

+0
-77
lines changed

pyiceberg/table/update/snapshot.py

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
from pyiceberg.table.update import (
6666
AddSnapshotUpdate,
6767
AssertRefSnapshotId,
68-
RemoveSnapshotRefUpdate,
6968
SetSnapshotRefUpdate,
7069
TableRequirement,
7170
TableUpdate,
@@ -750,28 +749,6 @@ def _commit(self) -> UpdatesAndRequirements:
750749
"""Apply the pending changes and commit."""
751750
return self._updates, self._requirements
752751

753-
def _remove_ref_snapshot(self, ref_name: str) -> ManageSnapshots:
754-
"""Remove a snapshot ref.
755-
756-
Args:
757-
ref_name: branch / tag name to remove
758-
Stages the updates and requirements for the remove-snapshot-ref.
759-
Returns
760-
This method for chaining
761-
"""
762-
updates = (RemoveSnapshotRefUpdate(ref_name=ref_name),)
763-
requirements = (
764-
AssertRefSnapshotId(
765-
snapshot_id=self._transaction.table_metadata.refs[ref_name].snapshot_id
766-
if ref_name in self._transaction.table_metadata.refs
767-
else None,
768-
ref=ref_name,
769-
),
770-
)
771-
self._updates += updates
772-
self._requirements += requirements
773-
return self
774-
775752
def create_tag(self, snapshot_id: int, tag_name: str, max_ref_age_ms: Optional[int] = None) -> ManageSnapshots:
776753
"""
777754
Create a new tag pointing to the given snapshot id.
@@ -794,17 +771,6 @@ def create_tag(self, snapshot_id: int, tag_name: str, max_ref_age_ms: Optional[i
794771
self._requirements += requirement
795772
return self
796773

797-
def remove_tag(self, tag_name: str) -> ManageSnapshots:
798-
"""
799-
Remove a tag.
800-
801-
Args:
802-
tag_name (str): name of tag to remove
803-
Returns:
804-
This for method chaining
805-
"""
806-
return self._remove_ref_snapshot(ref_name=tag_name)
807-
808774
def create_branch(
809775
self,
810776
snapshot_id: int,
@@ -836,14 +802,3 @@ def create_branch(
836802
self._updates += update
837803
self._requirements += requirement
838804
return self
839-
840-
def remove_branch(self, branch_name: str) -> ManageSnapshots:
841-
"""
842-
Remove a branch.
843-
844-
Args:
845-
branch_name (str): name of branch to remove
846-
Returns:
847-
This for method chaining
848-
"""
849-
return self._remove_ref_snapshot(ref_name=branch_name)

tests/integration/test_snapshot_operations.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -40,35 +40,3 @@ def test_create_branch(catalog: Catalog) -> None:
4040
branch_snapshot_id = tbl.history()[-2].snapshot_id
4141
tbl.manage_snapshots().create_branch(snapshot_id=branch_snapshot_id, branch_name="branch123").commit()
4242
assert tbl.metadata.refs["branch123"] == SnapshotRef(snapshot_id=branch_snapshot_id, snapshot_ref_type="branch")
43-
44-
45-
@pytest.mark.integration
46-
@pytest.mark.parametrize("catalog", [pytest.lazy_fixture("session_catalog_hive"), pytest.lazy_fixture("session_catalog")])
47-
def test_remove_tag(catalog: Catalog) -> None:
48-
identifier = "default.test_table_snapshot_operations"
49-
tbl = catalog.load_table(identifier)
50-
assert len(tbl.history()) > 3
51-
# first, create the tag to remove
52-
tag_name = "tag_to_remove"
53-
tag_snapshot_id = tbl.history()[-3].snapshot_id
54-
tbl.manage_snapshots().create_tag(snapshot_id=tag_snapshot_id, tag_name=tag_name).commit()
55-
assert tbl.metadata.refs[tag_name] == SnapshotRef(snapshot_id=tag_snapshot_id, snapshot_ref_type="tag")
56-
# now, remove the tag
57-
tbl.manage_snapshots().remove_tag(tag_name=tag_name).commit()
58-
assert tbl.metadata.refs.get(tag_name, None) is None
59-
60-
61-
@pytest.mark.integration
62-
@pytest.mark.parametrize("catalog", [pytest.lazy_fixture("session_catalog_hive"), pytest.lazy_fixture("session_catalog")])
63-
def test_remove_branch(catalog: Catalog) -> None:
64-
identifier = "default.test_table_snapshot_operations"
65-
tbl = catalog.load_table(identifier)
66-
assert len(tbl.history()) > 2
67-
# first, create the branch to remove
68-
branch_name = "branch_to_remove"
69-
branch_snapshot_id = tbl.history()[-2].snapshot_id
70-
tbl.manage_snapshots().create_branch(snapshot_id=branch_snapshot_id, branch_name=branch_name).commit()
71-
assert tbl.metadata.refs[branch_name] == SnapshotRef(snapshot_id=branch_snapshot_id, snapshot_ref_type="branch")
72-
# now, remove the branch
73-
tbl.manage_snapshots().remove_branch(branch_name=branch_name).commit()
74-
assert tbl.metadata.refs.get(branch_name, None) is None

0 commit comments

Comments
 (0)