Node.js did not provide parity with the Python tag fixes in #5136. `tags.create()` required an explicit version, and `branches.create()` could not fork from a tag without resolving a numeric version that loses the tag's branch identity. This adds Node.js parity: - `tags.create(tag, version?)` defaults an omitted version to the version visible to the table handle, including checked-out and time-travel handles. Explicit versions are unchanged. - `branches.create(name, { fromTag })` forks through `Ref::Tag`, preserving the tag's branch and version. Existing `create(name, fromRef?, fromVersion?)` calls are unchanged. Mixing `fromTag` with another source is rejected before `main` normalization. - A missing Embedded branch keeps its original error and now includes the actual `branches.create(..., { fromTag: ... })` call as guidance. Enterprise 404s keep their original error without guessing from the message. - Enterprise uses the existing tag resolution and branch-create wire contract; no wire changes. The released web guide remains on the published package examples. The new API is documented in the TypeScript API reference and source, with Node regression coverage.
2.8 KiB
@lancedb/lancedb • Docs
@lancedb/lancedb / Branches
Class: Branches
Branch manager for a Table.
Unlike tags, create and checkout return a new Table handle scoped
to the branch; writes on it do not affect main.
Methods
checkout()
checkout(name, version?): Promise<Table>
Check out an existing branch and return a handle scoped to it.
With version set, the returned handle is pinned to that version of the
branch (a read-only, detached view); otherwise it tracks the branch's
latest and stays writable.
Parameters
-
name:
string -
version?:
number
Returns
Promise<Table>
cherryPick()
cherryPick(fromBranch, dryRun): Promise<CherryPickResult>
Cherry-pick a branch onto main.
Set dryRun to true to preview. A failed cherry-pick resolves
with status: "failed" instead of throwing.
Parameters
-
fromBranch:
stringBranch to cherry-pick from. -
dryRun:
boolean=falseWhen true, only preview. Defaults to false.
Returns
Promise<CherryPickResult>
create()
create(name, options)
create(name, options): Promise<Table>
Create a branch from a tag and return a handle scoped to it.
Parameters
-
name:
stringName of the new branch. -
options:
CreateBranchOptionsNamed source.fromTagkeeps the tag's branch and version.
Returns
Promise<Table>
Example
const branches = await table.branches();
const branch = await branches.create("exp", { fromTag: "baseline" });
create(name, fromRef, fromVersion)
create(
name,
fromRef?,
fromVersion?): Promise<Table>
Create a branch and return a handle scoped to it.
Parameters
-
name:
stringName of the new branch. -
fromRef?:
stringSource branch to fork from. Defaults tomain. -
fromVersion?:
numberA specific version onfromRef. Defaults to latest.
Returns
Promise<Table>
delete()
delete(name): Promise<void>
Delete a branch.
Parameters
- name:
string
Returns
Promise<void>
diff()
diff(fromBranch): Promise<BranchDiff>
Compare a branch against main without modifying either branch.
Parameters
- fromBranch:
string
Returns
Promise<BranchDiff>
list()
list(): Promise<Record<string, BranchContents>>
List all branches, mapping name to branch metadata.
Returns
Promise<Record<string, BranchContents>>