mirror of
https://github.com/lancedb/lancedb.git
synced 2026-12-03 07:45:17 +00:00
Python callers can pass a `datetime` to `Table.checkout()` and `AsyncTable.checkout()` to read several tables as of a single cutoff. Each table is pinned to the highest retained version on its current branch whose reported commit timestamp is at or before the cutoff. A cutoff before all retained versions raises `ValueError`. The Rust `Table::checkout_as_of` method scans the branch's retained history and compares the commit timestamps at the precision supplied by the backend. On Embedded it resolves and checks out the version on the same dataset. If a concurrent tag checkout moves the handle to another branch, it retries there before pinning the handle. On Enterprise it follows all version-history pages on the same branch before checking out the selected version. Servers that report only whole milliseconds can group commits on opposite sides of a cutoff. For an exact reread, record both the branch and version of each input after checkout, then reopen the table with both values. Python interprets naive datetimes in the system's local time zone and honors explicit UTC offsets. The website guide includes a draft paragraph for the SDK release. Closes #2293. ## Validation - Built the Windows x64 native extension from this checkout with the repository's `ci` profile and CPython 3.12. - `test_table.py` passed 558 tests with 20 skips. `test_remote_db.py` passed 759 tests with 2 skips using its HTTP test server. - The new tests cover two tables at one cutoff, pinning after later writes, recovery with `checkout_latest()`, a cutoff before the first version, non-UTC input, tied commits, and a commit one nanosecond past the cutoff. All three also passed with `TZ=EST5EDT`. - A real Embedded handle switching branches during timestamp lookup selected the wrong branch version in 40/40 attempts before the concurrency fix and the expected version in 40/40 attempts afterward. The Rust regression test forces that interleaving with a filesystem-backed table. - A two-page Enterprise HTTP fixture reproduced checkout at v1 with the previous SDK and confirmed checkout at v2 after the fix. The Rust regression asserts the branch and continuation token on page two and reads back the pinned version. A separate test covers empty intermediate pages and repeated tokens. - Both Rust branch checkout tests and the `Table::checkout_as_of` doctest passed with the `remote` feature enabled. - Python SDK Ruff checks and formatting, Pyright, Rust formatting, and Vale passed. Repository-wide Ruff reports 59 existing diagnostics in the unchanged `docs/web-tests` files. --------- Co-authored-by: lipeih <lipeihan@eazytec.com>