mirror of
https://github.com/lancedb/lancedb.git
synced 2025-12-25 06:19:57 +00:00
[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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user