[python] improve restore functionality (#451)

Previously the temporary restore feature required copying data. The new
feature in pylance does not.

---------

Co-authored-by: Chang She <chang@lancedb.com>
Co-authored-by: Weston Pace <weston.pace@gmail.com>
This commit is contained in:
Chang She
2023-08-24 11:00:34 -07:00
committed by GitHub
parent a34fa4df26
commit 2f1f9f6338
2 changed files with 31 additions and 11 deletions

View File

@@ -280,3 +280,18 @@ def test_restore(db):
table.restore(1)
assert len(table.list_versions()) == 3
assert len(table) == 1
expected = table.to_arrow()
table.checkout(1)
table.restore()
assert len(table.list_versions()) == 4
assert table.to_arrow() == expected
table.restore(4) # latest version should be no-op
assert len(table.list_versions()) == 4
with pytest.raises(ValueError):
table.restore(5)
with pytest.raises(ValueError):
table.restore(0)