Skip to content

Commit 34d10b9

Browse files
committed
rename optimize -> maintenance
1 parent 9b6c9ed commit 34d10b9

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

pyiceberg/table/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@
8080
from pyiceberg.schema import Schema
8181
from pyiceberg.table.inspect import InspectTable
8282
from pyiceberg.table.locations import LocationProvider, load_location_provider
83+
from pyiceberg.table.maintenance import MaintenanceTable
8384
from pyiceberg.table.metadata import (
8485
INITIAL_SEQUENCE_NUMBER,
8586
TableMetadata,
8687
)
8788
from pyiceberg.table.name_mapping import (
8889
NameMapping,
8990
)
90-
from pyiceberg.table.optimize import OptimizeTable
9191
from pyiceberg.table.refs import SnapshotRef
9292
from pyiceberg.table.snapshots import (
9393
Snapshot,
@@ -1025,13 +1025,13 @@ def inspect(self) -> InspectTable:
10251025
return InspectTable(self)
10261026

10271027
@property
1028-
def optimize(self) -> OptimizeTable:
1029-
"""Return the OptimizeTable object to optimize.
1028+
def maintenance(self) -> MaintenanceTable:
1029+
"""Return the MaintenanceTable object for maintenance.
10301030
10311031
Returns:
1032-
OptimizeTable object based on this Table.
1032+
MaintenanceTable object based on this Table.
10331033
"""
1034-
return OptimizeTable(self)
1034+
return MaintenanceTable(self)
10351035

10361036
def refresh(self) -> Table:
10371037
"""Refresh the current table metadata.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from pyiceberg.table import Table
3232

3333

34-
class OptimizeTable:
34+
class MaintenanceTable:
3535
tbl: Table
3636

3737
def __init__(self, tbl: Table) -> None:

tests/table/test_remove_orphans.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,17 @@ def test_remove_orphaned_files(catalog: Catalog) -> None:
6969
assert orphaned_file.exists()
7070

7171
# assert no files deleted if dry run...
72-
tbl.optimize.remove_orphaned_files(dry_run=True)
72+
tbl.maintenance.remove_orphaned_files(dry_run=True)
7373
assert orphaned_file.exists()
7474

7575
# should not delete because it was just created...
76-
tbl.optimize.remove_orphaned_files()
76+
tbl.maintenance.remove_orphaned_files()
7777
assert orphaned_file.exists()
7878

7979
# modify creation date to be older than 3 days
8080
five_days_ago = (datetime.now() - timedelta(days=5)).timestamp()
8181
os.utime(orphaned_file, (five_days_ago, five_days_ago))
82-
tbl.optimize.remove_orphaned_files()
82+
tbl.maintenance.remove_orphaned_files()
8383
assert not orphaned_file.exists()
8484

8585
# assert that all known files still exist...
@@ -118,7 +118,7 @@ def test_remove_orphaned_files_with_invalid_file_doesnt_error(catalog: Catalog)
118118
tbl.append(df)
119119

120120
file_that_does_not_exist = "foo/bar.baz"
121-
with patch.object(type(tbl.optimize), "orphaned_files", return_value={file_that_does_not_exist}):
121+
with patch.object(type(tbl.maintenance), "orphaned_files", return_value={file_that_does_not_exist}):
122122
with patch.object(tbl.io, "delete", wraps=tbl.io.delete) as mock_delete:
123-
tbl.optimize.remove_orphaned_files(timedelta(days=3))
123+
tbl.maintenance.remove_orphaned_files(timedelta(days=3))
124124
mock_delete.assert_called_with(file_that_does_not_exist)

0 commit comments

Comments
 (0)