Skip to content

feat: support checking out a version on a branch#3504

Merged
brendanclement merged 1 commit into
mainfrom
feat/checkout-branch-version
Jun 9, 2026
Merged

feat: support checking out a version on a branch#3504
brendanclement merged 1 commit into
mainfrom
feat/checkout-branch-version

Conversation

@brendanclement

@brendanclement brendanclement commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Description

Stacked on #3490. Adds an optional version to branch checkout across the Rust core and the Python and TypeScript SDKs, so you can open a specific version on a branch ("version V of branch B"), not just the branch's latest version

Rust

// Open version 3 of branch "exp" (a read-only view): check out from an
// existing table, or open it directly from the connection.
let exp_v3 = table.checkout_branch("exp", Some(3)).await?;
let exp_v3 = db.open_table("items").branch("exp").version(3).execute().await?;
// checkout_latest re-attaches to the branch's writable HEAD.
exp_v3.checkout_latest().await?;

// With no branch, a version opens main at that version.
let main_v3 = db.open_table("items").version(3).execute().await?;

Python

# Open version 3 of branch "exp" (a read-only view): check out from an
# existing table, or open it directly from the connection.
branch_v3 = await table.branches.checkout("exp", version=3)
branch_v3 = await db.open_table("items", branch="exp", version=3)
# checkout_latest re-attaches to the branch's writable HEAD.
await branch_v3.checkout_latest()

# With no branch, a version opens main at that version.
main_v3 = await db.open_table("items", version=3)

TypeScript

// Open version 3 of branch "exp" (a read-only view): check out from an
// existing table, or open it directly from the connection.
const branchV3 = await (await table.branches()).checkout("exp", 3);
const opened = await db.openTable("items", undefined, { branch: "exp", version: 3 });
// checkoutLatest re-attaches to the branch's writable HEAD.
await branchV3.checkoutLatest();

// With no branch, a version opens main at that version.
const mainV3 = await db.openTable("items", undefined, { version: 3 });

Testing

  • Added unit tests (Rust, Python sync + async, TypeScript): branch-scoped resolution at a version number shared with main and with another branch, read-only enforcement on a pinned handle, checkout_latest recovery to the branch's HEAD, fork-point reads, and the nonexistent-version/branch error paths.
  • Ran smoke tests against the Python and TypeScript SDKs on local machine.

@brendanclement

Copy link
Copy Markdown
Contributor Author

@claude review once

@github-actions github-actions Bot added enhancement New feature or request Python Python SDK Rust Rust related issues labels Jun 5, 2026
@brendanclement brendanclement added the typescript Typescript / javascript label Jun 5, 2026
Comment thread python/python/lancedb/db.py
@brendanclement
brendanclement force-pushed the feat/checkout-branch-version branch from 83084c5 to 7c5a8cb Compare June 5, 2026 03:47
@brendanclement

Copy link
Copy Markdown
Contributor Author

@claude review once

Comment thread python/python/lancedb/remote/db.py
@brendanclement
brendanclement force-pushed the feat/checkout-branch-version branch 2 times, most recently from 365d276 to 331f03c Compare June 5, 2026 04:31
@brendanclement
brendanclement marked this pull request as ready for review June 5, 2026 04:32

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@wjones127 wjones127 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very clean. Nice work!

Comment thread rust/lancedb/src/table.rs
Comment on lines +3613 to +3614
#[tokio::test]
async fn test_branch_version_checkout() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: these tests are excellent!

@brendanclement
brendanclement force-pushed the feat/checkout-branch-version branch 2 times, most recently from 77e80df to dd6d20b Compare June 8, 2026 22:53
Base automatically changed from feat/table-branches to main June 8, 2026 23:26
@brendanclement
brendanclement force-pushed the feat/checkout-branch-version branch from dd6d20b to 812d418 Compare June 8, 2026 23:37
@brendanclement
brendanclement merged commit d901806 into main Jun 9, 2026
29 checks passed
@brendanclement
brendanclement deleted the feat/checkout-branch-version branch June 9, 2026 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Python Python SDK Rust Rust related issues typescript Typescript / javascript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants