diff --git a/python/python/tests/test_table.py b/python/python/tests/test_table.py index e30ee4db..dac73570 100644 --- a/python/python/tests/test_table.py +++ b/python/python/tests/test_table.py @@ -1034,6 +1034,12 @@ async def test_optimize(db_async: AsyncConnection): ], ) stats = await table.optimize() + expected = ( + "OptimizeStats(compaction=CompactionStats { fragments_removed: 2, " + "fragments_added: 1, files_removed: 2, files_added: 1 }, " + "prune=RemovalStats { bytes_removed: 0, old_versions_removed: 0 })" + ) + assert str(stats) == expected assert stats.compaction.files_removed == 2 assert stats.compaction.files_added == 1 assert stats.compaction.fragments_added == 1 diff --git a/python/src/table.rs b/python/src/table.rs index 804612c5..443591ca 100644 --- a/python/src/table.rs +++ b/python/src/table.rs @@ -60,6 +60,13 @@ pub struct Table { inner: Option, } +#[pymethods] +impl OptimizeStats { + pub fn __repr__(&self) -> String { + format!("OptimizeStats(compaction={:?}, prune={:?})", self.compaction, self.prune) + } +} + impl Table { pub(crate) fn new(inner: LanceDbTable) -> Self { Self {