Merge main into gatekeeper/fix-4843-1

This commit is contained in:
Gatefixer
2026-11-20 21:51:06 +00:00
429 changed files with 83524 additions and 10324 deletions
@@ -0,0 +1,63 @@
---
name: lancedb-vector-dedup
description: Plan and run Enterprise IVF vector deduplication with dedupe and duplicate_pairs, including sampling, index coverage, recall and resource limits. Use for near-duplicate embedding or perceptual-hash records; use MinHash guidance for text shingles.
---
# Vector deduplication
Read the maintained [workflow](../../../docs/web/curation/dedupe.mdx),
[DEDUPE reference](../../../docs/web/sql/dql/dedupe.mdx) and
[DUPLICATE_PAIRS reference](../../../docs/web/sql/dql/duplicate-pairs.mdx)
before constructing SQL. In a source checkout these paths are relative to this
skill directory. When using an installed copy without the docs, read
`https://docs.lancedb.com/curation/dedupe` and the linked SQL references.
## Establish the comparison contract
- Confirm an Enterprise deployment that supports these table functions. Use
`dedupe` and `duplicate_pairs`; legacy `vector_dedup` names are rejected.
- Inspect the vector type, metric, compatible index, indexed fragments and
source version. Wait for index coverage after writes. Do not run a full
scan over unindexed fragments or silently change the index to make it run.
- Explain that candidates are compared only within physical IVF partitions
and segments. Encoded/quantized distances are not an exact raw-vector
comparison. L2 thresholds are squared distances; Hamming counts bits.
- Use `id_column` on pair queries for business IDs. Retain `dataset_version`,
segment and partition identities. Do not decode internal row IDs or assume
that representatives stay the same after later data/index changes.
## Bound the first experiment
Use a reproducible partition sample before a full scan:
```sql
SELECT id_a, id_b, distance, dataset_version, segment_id, partition_id
FROM duplicate_pairs(
'frames', 'embedding',
distance_threshold => 0.02,
id_column => 'frame_id',
selection => 'random', count => 10, seed => 42
)
```
Adapt the threshold and sample size to the metric and actual partition count.
Sampling partitions is not uniform sampling of rows. Inspect known duplicate
and distinct examples, pair density, partition skew, memory, spill space and
elapsed time. Do not infer global recall or ten-billion-row qualification
from a small or unversioned benchmark. Pair work and output can be quadratic
within a partition; an outer SQL `LIMIT` is not an upstream work budget.
## Choose the result
`dedupe` returns original representative rows and always scans all partitions.
Use its default `connected_components` for transitive groups; choose
`direct_representative` when chains should not merge transitively. It does not
accept `id_column`, `selection`, `count` or `seed`; `duplicate_pairs` does not
accept `resolution`.
Keep pair data on the server when possible; avoid collecting an unbounded
edge set in client memory. Persist a new table/view only within the user's
authorized scope, preserving source rows unless deletion was requested.
Do not register a Python Function or fetch/rewrite Blob payloads to invoke
these built-in table functions. For MinHash/text deduplication, follow the
separate `https://docs.lancedb.com/enterprise/sql-minhash` workflow.
+1 -1
View File
@@ -1,5 +1,5 @@
[tool.bumpversion]
current_version = "0.42.0-beta.4"
current_version = "0.42.0-beta.20"
parse = """(?x)
(?P<major>0|[1-9]\\d*)\\.
(?P<minor>0|[1-9]\\d*)\\.
+120 -45
View File
@@ -1,70 +1,145 @@
version: 2
# Scope: the root Cargo workspace, which produces the Rust binaries we
# ship to users (the Node.js and Python native extensions). The
# `rust/lancedb` library crate shares the same lockfile; its consumers
# pick their own dependency versions, but bumping transitive deps here
# keeps the binaries we ship current.
# Every entry uses `versioning-strategy: lockfile-only`: bump the lockfile,
# never widen or raise the version requirements in manifests. Those ranges are
# our library consumers' constraints, not ours.
#
# Because of that, version updates are limited to minor and patch bumps.
# A semver-breaking bump (including 0.x minor bumps such as 0.12 -> 0.13)
# can't be satisfied without editing a manifest, so Dependabot would produce a
# lockfile that fails `cargo --locked` and every CI job. We do those by hand.
# This is done with `allow` rather than `ignore` because `allow.update-types`
# only filters version updates; an `ignore` rule would also suppress security
# updates. `dependency-type: all` matters for the same reason: `allow` does
# apply to security updates otherwise, and most advisories are in transitive
# dependencies.
#
# Security updates are grouped so advisories that land together become one PR.
# They ignore `schedule` and `cooldown` and are opened as soon as an advisory
# is published.
updates:
# Highest priority: the root Cargo workspace is statically linked into the
# Node.js and Python native extensions we ship, so users can't patch these
# themselves. Weekly updates keep the lockfile close to current, so security
# fixes are usually small patch bumps.
- package-ecosystem: cargo
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 10
# Only update Cargo.lock, never widen/raise the version requirements in
# Cargo.toml. The goal is keeping the lockfile (and the binaries we ship)
# current on security fixes, not forcing our library's consumers onto
# newer minimum versions.
day: wednesday
cooldown:
default-days: 2
versioning-strategy: lockfile-only
groups:
# The arrow-rs and datafusion crates are released in lockstep and have to
# move together, so keep them in one PR instead of one per sub-crate.
# Listed first: a dependency joins the first group it matches.
arrow-datafusion:
patterns:
- arrow
- arrow-*
- parquet
- parquet-*
- datafusion
- datafusion-*
- object_store
rust-minor-patch:
allow:
- dependency-type: all
update-types:
- minor
- patch
- version-update:semver-minor
- version-update:semver-patch
groups:
cargo:
applies-to: version-updates
patterns:
- "*"
cargo-security:
applies-to: security-updates
patterns:
- "*"
- package-ecosystem: pip
# Python and Node.js dependencies are resolved in the user's own environment,
# so these lockfiles only affect our dev/test setup. Lower priority: monthly.
- package-ecosystem: uv
directory: /python
schedule:
interval: weekly
# Only update uv.lock, never widen version requirements in pyproject.toml.
interval: monthly
cooldown:
default-days: 2
versioning-strategy: lockfile-only
allow:
- dependency-type: all
update-types:
- version-update:semver-minor
- version-update:semver-patch
groups:
python-deps:
python:
applies-to: version-updates
patterns:
- "*"
# The npm ecosystem covers pnpm lockfiles. There are two separate installs:
# the bindings themselves and the examples, which have their own lockfile.
# As with cargo and pip above, only bump the lockfile — the version ranges
# in package.json are our consumers' constraints, not ours.
- package-ecosystem: npm
directory: /nodejs
schedule:
interval: weekly
versioning-strategy: lockfile-only
groups:
nodejs-deps:
python-security:
applies-to: security-updates
patterns:
- "*"
- package-ecosystem: npm
directory: /nodejs/examples
directories:
- /nodejs
- /nodejs/examples
schedule:
interval: weekly
interval: monthly
cooldown:
default-days: 2
versioning-strategy: lockfile-only
allow:
- dependency-type: all
update-types:
- version-update:semver-minor
- version-update:semver-patch
groups:
nodejs-examples-deps:
nodejs:
applies-to: version-updates
patterns:
- "*"
nodejs-security:
applies-to: security-updates
patterns:
- "*"
# Docs, docs tests, and Java. Security updates scan these lockfiles whether or
# not they're listed here; these entries only exist to group those PRs.
# `open-pull-requests-limit: 0` turns off version updates.
- package-ecosystem: cargo
directory: /docs/web-tests/rs
schedule:
interval: monthly
open-pull-requests-limit: 0
groups:
docs-cargo-security:
applies-to: security-updates
patterns:
- "*"
- package-ecosystem: npm
directories:
- /docs/web-tests/ts
- /docs/web-tests/blob-v2/ts
schedule:
interval: monthly
open-pull-requests-limit: 0
groups:
docs-npm-security:
applies-to: security-updates
patterns:
- "*"
- package-ecosystem: pip
directories:
- /docs
- /docs/web-tests/blob-v2/py
schedule:
interval: monthly
open-pull-requests-limit: 0
groups:
docs-pip-security:
applies-to: security-updates
patterns:
- "*"
- package-ecosystem: maven
directory: /java
schedule:
interval: monthly
open-pull-requests-limit: 0
groups:
maven-security:
applies-to: security-updates
patterns:
- "*"
+1 -1
View File
@@ -10,7 +10,7 @@ come from the `LanceDB.zip` asset of `lancedb/docs` release
The product-terminology rules were added here: `EmbeddedName`,
`RemoteExecution`, `OSSProduct`, `InternalNames`
(warnings) and `LegacyCloud` (suggestion). They enforce the names in the
docs repository's `STYLE.md#names`. Run every rule's tests from
[style guide](../../docs/STYLE.md#names). Run every rule's tests from
`.github/vale` with `vale test --coverage styles`.
Keeping the rules here lets contributors and CI run Vale without access to the
+1 -1
View File
@@ -1,6 +1,6 @@
extends: existence
message: "Avoid '%s' in prose. Use a comma, a colon, parentheses or two sentences."
link: https://github.com/lancedb/docs/blob/main/STYLE.md#punctuation
link: https://github.com/lancedb/lancedb/blob/main/docs/STYLE.md#punctuation
level: warning
nonword: true
# An em dash in prose, and a double hyphen or en dash used as one, with a
+1 -1
View File
@@ -1,6 +1,6 @@
extends: substitution
message: "Use '%s' instead of '%s'."
link: https://github.com/lancedb/docs/blob/main/STYLE.md#names
link: https://github.com/lancedb/lancedb/blob/main/docs/STYLE.md#names
level: warning
ignorecase: false
# The in-process execution model is LanceDB Embedded, whether the data is on
@@ -1,6 +1,6 @@
extends: substitution
message: "Use '%s' instead of the internal name '%s'."
link: https://github.com/lancedb/docs/blob/main/STYLE.md#names
link: https://github.com/lancedb/lancedb/blob/main/docs/STYLE.md#names
level: warning
ignorecase: false
# Internal component names stay out of public text. Environment variables such
+1 -1
View File
@@ -1,6 +1,6 @@
extends: existence
message: "'%s' is the legacy hosted service. Unless the text is specific to it, write 'LanceDB Enterprise'."
link: https://github.com/lancedb/docs/blob/main/STYLE.md#names
link: https://github.com/lancedb/lancedb/blob/main/docs/STYLE.md#names
level: suggestion
ignorecase: false
# A suggestion, because `db://` URIs, `api_key` and `region` for the hosted
+1 -1
View File
@@ -1,6 +1,6 @@
extends: existence
message: "Avoid '%s'. OSS is not a product name: write 'LanceDB Embedded', or 'open source' as a property."
link: https://github.com/lancedb/docs/blob/main/STYLE.md#names
link: https://github.com/lancedb/lancedb/blob/main/docs/STYLE.md#names
level: warning
ignorecase: false
# Bare OSS used as a product, as in "OSS and Enterprise" or "in OSS". "LanceDB
@@ -1,6 +1,6 @@
extends: substitution
message: "Consider '%s' instead of '%s'."
link: https://github.com/lancedb/docs/blob/main/STYLE.md#say-it-directly
link: https://github.com/lancedb/lancedb/blob/main/docs/STYLE.md#say-it-directly
level: suggestion
ignorecase: true
# Keep this list small. Technical nouns such as GPU utilization stay intact.
+1 -1
View File
@@ -1,6 +1,6 @@
extends: substitution
message: "Use '%s' instead of '%s'."
link: https://github.com/lancedb/docs/blob/main/STYLE.md#names
link: https://github.com/lancedb/lancedb/blob/main/docs/STYLE.md#names
level: warning
ignorecase: false
# Case-sensitive. A lowercase package, repository or domain name, such as
@@ -1,6 +1,6 @@
extends: existence
message: "Avoid '%s'. Write 'LanceDB Enterprise' and describe where the operation runs directly."
link: https://github.com/lancedb/docs/blob/main/STYLE.md#names
link: https://github.com/lancedb/lancedb/blob/main/docs/STYLE.md#names
level: warning
ignorecase: false
# Remote storage, remote URLs and a git remote are other things and stay. Class
@@ -1,6 +1,6 @@
extends: existence
message: "'%s' doesn't say what the section covers. Name the task or topic instead."
link: https://github.com/lancedb/docs/blob/main/STYLE.md#headings
link: https://github.com/lancedb/lancedb/blob/main/docs/STYLE.md#headings
level: suggestion
scope: heading
ignorecase: true
+1 -1
View File
@@ -1,6 +1,6 @@
extends: existence
message: "'%s' talks about the writing, not the subject. State the point directly."
link: https://github.com/lancedb/docs/blob/main/STYLE.md#say-it-directly
link: https://github.com/lancedb/lancedb/blob/main/docs/STYLE.md#say-it-directly
level: suggestion
ignorecase: false
scope: sentence
@@ -54,7 +54,7 @@ runs:
grep '^name = ' python/pyproject.toml
- name: Build x86_64 Manylinux wheel
if: ${{ inputs.arm-build == 'false' }}
uses: PyO3/maturin-action@v1
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
maturin-version: "1.12.4"
command: build
@@ -72,7 +72,7 @@ runs:
/usr/local/bin/protoc --version
- name: Build Arm Manylinux Wheel
if: ${{ inputs.arm-build == 'true' }}
uses: PyO3/maturin-action@v1
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
maturin-version: "1.12.4"
command: build
+1 -1
View File
@@ -14,7 +14,7 @@ runs:
steps:
- uses: ./.github/actions/setup-protoc
- name: Build wheel
uses: PyO3/maturin-action@v1
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
command: build
maturin-version: "1.12.4"
@@ -12,9 +12,12 @@ inputs:
runs:
using: "composite"
steps:
- name: Enable long paths for Lance dependencies
shell: bash
run: git config --global core.longpaths true
- uses: ./.github/actions/setup-protoc
- name: Build wheel
uses: PyO3/maturin-action@v1
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
command: build
maturin-version: "1.12.4"
+2 -2
View File
@@ -25,14 +25,14 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v6
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
workspaces: rust
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y protobuf-compiler libssl-dev
- uses: rust-lang/crates-io-auth-action@v1
- uses: rust-lang/crates-io-auth-action@3268eb413133e2960fa4ae0e963ca76380c54cd9 # v1.0.6
id: auth
- name: Publish the package
run: |
+32
View File
@@ -0,0 +1,32 @@
name: CLI shell installer
on:
pull_request:
paths:
- 'scripts/install.sh'
- 'ci/tests/test_cli_installer.sh'
- '.github/workflows/cli-installer.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
install:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, macos-15]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- run: sh ci/tests/test_cli_installer.sh
- name: Install a pinned public release and run it
env:
LANCEDB_VERSION: v0.42.0-beta.19
run: |
export LANCEDB_INSTALL_DIR="$RUNNER_TEMP/cli bin"
sh scripts/install.sh
test "$("$LANCEDB_INSTALL_DIR/lancedb" --version)" = "lancedb ${LANCEDB_VERSION#v}"
"$LANCEDB_INSTALL_DIR/lancedb" profile list
+2
View File
@@ -23,6 +23,8 @@ jobs:
- uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
with:
components: clippy
# Use only the downloads-only cache configured below.
cache: false
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2
with:
# Restoring compiled targets can exhaust the hosted runner disk.
@@ -16,14 +16,14 @@ on:
default: ""
type: string
permissions:
contents: write
pull-requests: write
actions: read
permissions: {}
jobs:
update:
runs-on: ubuntu-latest
permissions:
# Pushes the branch with the checkout token. PR creation uses ROBOT_TOKEN.
contents: write
steps:
- name: Show inputs
run: |
@@ -44,7 +44,7 @@ jobs:
run: npm install -g @openai/codex
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
with:
toolchain: stable
components: clippy, rustfmt
+2 -2
View File
@@ -18,7 +18,7 @@ jobs:
name: Label PR
runs-on: ubuntu-latest
steps:
- uses: srvaroa/labeler@v1
- uses: srvaroa/labeler@9c29ad1ef33d169f9ef33c52722faf47a566bcf3 # v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
commitlint:
@@ -30,7 +30,7 @@ jobs:
- uses: actions/setup-node@v6
with:
node-version: "24"
- uses: pnpm/action-setup@v6
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
with:
version: 11.1.1
# These rules are disabled because Github will always ensure there
+1 -1
View File
@@ -47,7 +47,7 @@ jobs:
python-version: "3.10"
cache: "pip"
cache-dependency-path: "docs/requirements.txt"
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
- name: Build Python
working-directory: python
run: |
+2 -2
View File
@@ -77,7 +77,7 @@ jobs:
echo "from_tag=$FROM_TAG" >> $GITHUB_OUTPUT
- name: Create Release Notes
id: release_notes
uses: mikepenz/release-changelog-builder-action@v4
uses: mikepenz/release-changelog-builder-action@32e3c96f29a6532607f638797455e9e98cfc703d # v4.2.2
with:
configuration: .github/release_notes.json
toTag: ${{ steps.extract_version.outputs.tag }}
@@ -85,7 +85,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GH release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2
with:
# Marking betas as pre-releases keeps them from taking the "Latest"
# badge on the releases page.
+15 -5
View File
@@ -39,9 +39,11 @@ jobs:
distribution: temurin
java-version: 8
cache: "maven"
server-id: ossrh
server-username: SONATYPE_USER
server-password: SONATYPE_TOKEN
# Betas go to Fury and stable releases to Maven Central, which limits
# how many releases an organization may publish each month.
server-id: ${{ contains(github.ref, 'beta') && 'fury' || 'ossrh' }}
server-username: ${{ contains(github.ref, 'beta') && 'FURY_TOKEN' || 'SONATYPE_USER' }}
server-password: ${{ contains(github.ref, 'beta') && 'FURY_PASSWORD' || 'SONATYPE_TOKEN' }}
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Set git config
@@ -52,8 +54,16 @@ jobs:
if: github.event_name == 'pull_request'
run: |
./mvnw --batch-mode -DskipTests package -pl lancedb-core -am
- name: Publish
if: startsWith(github.ref, 'refs/tags/v')
- name: Publish to Fury
if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'beta')
run: |
./mvnw --batch-mode -DskipTests deploy -pl lancedb-core -am -P deploy-to-fury
env:
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
# Fury authenticates with the token as the username; the password is ignored.
FURY_PASSWORD: NOPASS
- name: Publish to Maven Central
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'beta')
run: |
echo "use-agent" >> ~/.gnupg/gpg.conf
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
+2 -3
View File
@@ -21,11 +21,10 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v6
# `go install` at a fixed version is verified against the Go checksum database.
- name: Install license-header-checker
working-directory: /tmp
run: |
curl -s https://raw.githubusercontent.com/lluissm/license-header-checker/master/install.sh | bash
mv /tmp/bin/license-header-checker /usr/local/bin/
GOBIN=/usr/local/bin go install github.com/lluissm/license-header-checker/cmd/license-header-checker@v1.5.0
- name: Check license headers (rust)
run: license-header-checker -a -v ./rust/license_header.txt ./ rs && [[ -z `git status -s` ]]
- name: Check license headers (python)
+6 -2
View File
@@ -39,7 +39,9 @@ jobs:
contents: write
steps:
- name: Output Inputs
run: echo "${{ toJSON(github.event.inputs) }}"
env:
INPUTS_JSON: ${{ toJSON(github.event.inputs) }}
run: echo "$INPUTS_JSON"
- uses: actions/checkout@v6
with:
fetch-depth: 0
@@ -59,9 +61,11 @@ jobs:
- name: Bump version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TYPE: ${{ inputs.type }}
BUMP_MINOR: ${{ inputs.bump-minor }}
run: |
pip install bump-my-version PyGithub packaging
bash ci/bump_version.sh ${{ inputs.type }} ${{ inputs.bump-minor }}
bash ci/bump_version.sh "$RELEASE_TYPE" "$BUMP_MINOR"
release_tag=$(git describe --tags --exact-match HEAD)
bash ci/update_lockfiles.sh --amend
# Keep the unpublished tag on the commit that includes the synced lockfile.
+16 -11
View File
@@ -42,7 +42,7 @@ jobs:
with:
fetch-depth: 0
lfs: true
- uses: pnpm/action-setup@v6
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
with:
version: 11.1.1
- uses: actions/setup-node@v6
@@ -52,14 +52,14 @@ jobs:
node-version: 24
cache: 'pnpm'
cache-dependency-path: nodejs/pnpm-lock.yaml
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
components: rustfmt, clippy
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y protobuf-compiler libssl-dev
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
# Restore everywhere, but only save from main. Per-PR saves are
# unreadable outside their own branch anyway, since GitHub scopes
@@ -98,7 +98,7 @@ jobs:
with:
fetch-depth: 0
lfs: true
- uses: pnpm/action-setup@v6
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
with:
version: 11.1.1
- uses: actions/setup-node@v6
@@ -110,7 +110,7 @@ jobs:
node-version: 24
cache: 'pnpm'
cache-dependency-path: nodejs/pnpm-lock.yaml
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
# Restore everywhere, but only save from main. Per-PR saves are
# unreadable outside their own branch anyway, since GitHub scopes
@@ -188,7 +188,7 @@ jobs:
with:
fetch-depth: 0
lfs: true
- uses: pnpm/action-setup@v6
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
with:
version: 11.1.1
- uses: actions/setup-node@v6
@@ -196,7 +196,7 @@ jobs:
node-version: 24
cache: 'pnpm'
cache-dependency-path: nodejs/pnpm-lock.yaml
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
# Same crate, profile and target as the `linux` job above, so reuse
# its cache: rust-cache keys on the job id by default, and this job
@@ -234,7 +234,8 @@ jobs:
NODE_OPTIONS: "--experimental-vm-modules"
run: node_modules/.bin/jest --verbose
macos:
timeout-minutes: 30
# Cold native builds can take 28 minutes; reserve time for setup and Jest.
timeout-minutes: 35
# macos-15 ships a newer linker; the older macos-14 linker fails to insert
# branch islands when the debug cdylib's __text section exceeds the 128 MB
# AArch64 B/BL branch range.
@@ -248,7 +249,7 @@ jobs:
with:
fetch-depth: 0
lfs: true
- uses: pnpm/action-setup@v6
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
with:
version: 11.1.1
- uses: actions/setup-node@v6
@@ -257,8 +258,12 @@ jobs:
node-version: 24
cache: 'pnpm'
cache-dependency-path: nodejs/pnpm-lock.yaml
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# Use the same pinned compiler for cache selection and the native build.
- uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
cache: false
rustflags: ""
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
# Restore everywhere, but only save from main. Per-PR saves are
# unreadable outside their own branch anyway, since GitHub scopes
+24 -13
View File
@@ -4,9 +4,7 @@ env:
MACOSX_DEPLOYMENT_TARGET: '10.13'
CARGO_INCREMENTAL: '0'
permissions:
contents: write
id-token: write
permissions: {}
on:
push:
@@ -33,6 +31,8 @@ concurrency:
jobs:
build-lancedb:
permissions:
contents: read
strategy:
fail-fast: false
matrix:
@@ -66,7 +66,8 @@ jobs:
choco install --no-progress protoc
rustup target add aarch64-pc-windows-msvc
- target: x86_64-unknown-linux-gnu
host: ubuntu-latest
# Fat LTO reached 15.1 GiB before rustc was killed on the 15 GiB runner.
host: ubuntu-2404-8x-x64
features: fp16kernels
# https://github.com/napi-rs/napi-rs/blob/main/debian.Dockerfile
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
@@ -161,8 +162,12 @@ jobs:
working-directory: nodejs
steps:
- uses: actions/checkout@v6
- name: Enable long paths for Windows dependencies
if: runner.os == 'Windows'
# Cargo also checks out Lance test fixtures below its git cache path.
run: git config --global core.longpaths true
- name: Setup pnpm
uses: pnpm/action-setup@v6
uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
with:
version: 11.1.1
- name: Setup node
@@ -173,7 +178,7 @@ jobs:
cache: pnpm
cache-dependency-path: nodejs/pnpm-lock.yaml
- name: Install
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
if: ${{ !matrix.settings.docker }}
with:
toolchain: stable
@@ -189,7 +194,7 @@ jobs:
# re-runs regardless, since the local crate changes every time, so the
# win is larger on the non-LTO jobs than here.
- name: Cache cargo (native builds)
uses: Swatinem/rust-cache@v2
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
if: ${{ !matrix.settings.docker }}
with:
# The release profile and per-target dirs differ from what the test
@@ -211,7 +216,7 @@ jobs:
# that built these artifacts -- safe, since cargo fingerprints the real
# one; a base-image bump just costs one cold build.
- name: Cache cargo (docker builds)
uses: Swatinem/rust-cache@v2
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
if: ${{ matrix.settings.docker }}
with:
key: docker-${{ matrix.settings.target }}
@@ -220,17 +225,17 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Zig
uses: mlugg/setup-zig@v2
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
if: ${{ contains(matrix.settings.target, 'musl') }}
with:
version: 0.14.1
- name: Install cargo-zigbuild
uses: taiki-e/install-action@v2
uses: taiki-e/install-action@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3
if: ${{ contains(matrix.settings.target, 'musl') }}
with:
tool: cargo-zigbuild
- name: Build in docker
uses: addnab/docker-run-action@v3
uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3
if: ${{ matrix.settings.docker }}
with:
image: ${{ matrix.settings.docker }}
@@ -321,6 +326,8 @@ jobs:
nodejs/dist/*
!nodejs/dist/*.node
test-lancedb:
permissions:
contents: read
name: "Test: ${{ matrix.settings.target }} - node@${{ matrix.node }}"
needs:
- build-lancedb
@@ -347,7 +354,7 @@ jobs:
steps:
- uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v6
uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
with:
version: 11.1.1
- name: Setup Node.js 24 for install
@@ -389,6 +396,10 @@ jobs:
run: node_modules/.bin/jest --verbose
publish:
name: Publish
permissions:
contents: read
# npm provenance
id-token: write
runs-on: ubuntu-latest
defaults:
run:
@@ -399,7 +410,7 @@ jobs:
steps:
- uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v6
uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
with:
version: 11.1.1
- name: Setup node
@@ -0,0 +1,48 @@
name: Publish CLI installer
on:
push:
branches: [main]
paths:
- scripts/install.sh
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
publish:
if: github.repository == 'lancedb/lancedb' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
concurrency:
group: publish-cli-installer
cancel-in-progress: false
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Queued jobs and retries publish the installer currently on main.
ref: refs/heads/main
persist-credentials: false
- uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
with:
aws-region: us-west-2
role-to-assume: ${{ vars.CLI_INSTALLER_AWS_ROLE_ARN }}
- name: Publish and verify the installer
shell: bash
env:
DISTRIBUTION_ID: ${{ vars.CLI_INSTALLER_DISTRIBUTION_ID }}
run: |
: "${DISTRIBUTION_ID:?Set CLI_INSTALLER_DISTRIBUTION_ID before publishing}"
key=cli/install.sh
aws s3api put-object --bucket lancedb-downloads --key "$key" \
--body scripts/install.sh --content-type 'text/plain; charset=utf-8' \
--cache-control 'public, max-age=0, must-revalidate' > /dev/null
invalidation=$(aws cloudfront create-invalidation --distribution-id "$DISTRIBUTION_ID" \
--paths "/$key" --query Invalidation.Id --output text)
aws cloudfront wait invalidation-completed --distribution-id "$DISTRIBUTION_ID" --id "$invalidation"
curl --fail --silent --show-error --retry 3 "https://downloads.lancedb.com/$key" \
--output "$RUNNER_TEMP/published-installer.sh"
cmp scripts/install.sh "$RUNNER_TEMP/published-installer.sh"
+9 -6
View File
@@ -36,14 +36,15 @@ concurrency:
jobs:
linux:
name: Python ${{ matrix.config.package_name }} ${{ matrix.config.platform }} manylinux${{ matrix.config.manylinux }}
timeout-minutes: 60
# ARM64 and compatibility release builds can exceed an hour with cold fat LTO.
timeout-minutes: ${{ (matrix.config.platform == 'aarch64' || matrix.config.package_name == 'lancedb-compat') && 120 || 60 }}
strategy:
matrix:
config:
- platform: x86_64
manylinux: "2_28"
extra_args: "--features fp16kernels"
runner: ubuntu-22.04
runner: ubuntu-2404-8x-x64
package_name: "lancedb"
rustflags: ""
# For successful fat LTO builds, we need a large runner to avoid OOM errors.
@@ -63,7 +64,8 @@ jobs:
- platform: x86_64
manylinux: "2_28"
extra_args: ""
runner: ubuntu-22.04
# Keep fat LTO on the same larger runner as the standard x64 wheel.
runner: ubuntu-2404-8x-x64
package_name: "lancedb-compat"
rustflags: "-Ctarget-cpu=x86-64-v2"
runs-on: ${{ matrix.config.runner }}
@@ -101,7 +103,8 @@ jobs:
path: target/wheels/*.whl
if-no-files-found: error
mac:
timeout-minutes: 90
# Cold fat LTO was still compiling when the 90-minute limit was reached.
timeout-minutes: 150
runs-on: ${{ matrix.config.runner }}
strategy:
matrix:
@@ -181,7 +184,7 @@ jobs:
with:
python-version: "3.12"
- name: Build sdist
uses: PyO3/maturin-action@v1
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
maturin-version: "1.12.4"
command: sdist
@@ -308,7 +311,7 @@ jobs:
# `docker://ghcr.io/<repo>:<ref>` image reference that GHA tries to pull.
- name: Publish to PyPI
if: steps.choose_repo.outputs.repo == 'pypi'
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
with:
packages-dir: target/wheels/
report-failure:
+8 -6
View File
@@ -112,7 +112,7 @@ jobs:
# `pip install -e .` builds the extension with maturin, which is most of
# this job's ~33 minutes. It had no Rust cache, so every dependency was
# recompiled from scratch on every run.
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
# Restore everywhere, but only save from main. Per-PR saves are
# unreadable outside their own branch anyway, since GitHub scopes
@@ -130,7 +130,8 @@ jobs:
run: pytest --doctest-modules python/lancedb
linux:
name: "Linux: python-3.${{ matrix.python-minor-version }}"
timeout-minutes: 30
# A cold native build plus both test passes can exhaust 30 minutes.
timeout-minutes: 60
strategy:
matrix:
python-minor-version: ["10", "13"]
@@ -179,7 +180,8 @@ jobs:
strategy:
matrix:
features: ["default", "experimental-functions"]
timeout-minutes: 30
# A cold native build plus experimental-functions tests can exceed 30 minutes.
timeout-minutes: 60
runs-on: macos-15
defaults:
run:
@@ -196,7 +198,7 @@ jobs:
python-version: "3.13"
# maturin runs cargo natively on macOS (docker is Linux-only), so the host
# target dir is cacheable. This job had no Rust cache.
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
# Restore everywhere, but only save from main. Per-PR saves are
# unreadable outside their own branch anyway, since GitHub scopes
@@ -234,7 +236,7 @@ jobs:
# maturin runs cargo natively on Windows (docker is Linux-only), so the
# host target dir is cacheable. This job had no Rust cache at all and so
# rebuilt every dependency from scratch on every run.
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
# Restore everywhere, but only save from main. The repo sits at
# GitHub's cache cap, so per-PR saves just evict main's entries.
@@ -269,7 +271,7 @@ jobs:
python-version: "3.10"
# As with Doctest, `pip install -e .` compiles the extension and this job
# had no Rust cache, which is most of its ~37 minutes.
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
# Restore everywhere, but only save from main. Per-PR saves are
# unreadable outside their own branch anyway, since GitHub scopes
+41 -24
View File
@@ -14,6 +14,9 @@ on:
- docs/web-tests/blob-v2/rs/**
- nodejs/Cargo.toml
- python/Cargo.toml
- python/src/**
- python/python/lancedb/exceptions.py
- python/python/lancedb/remote/errors.py
- ci/build_no_lock.py
- ci/tests/test_build_no_lock.py
- .github/actions/setup-protoc/**
@@ -39,7 +42,7 @@ jobs:
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
- name: Read the pinned Lance tag
id: lance
run: |
@@ -105,10 +108,10 @@ jobs:
with:
fetch-depth: 0
lfs: true
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
# Restore everywhere, but only save from main. Per-PR saves are
# unreadable outside their own branch anyway, since GitHub scopes
@@ -132,7 +135,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: EmbarkStudios/cargo-deny-action@v2
- uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 # v2.1.1
with:
command: check advisories bans licenses sources
@@ -148,14 +151,16 @@ jobs:
- uses: actions/checkout@v6
# Building without a lock file often requires the latest Rust version since downstream
# dependencies may have updated their minimum Rust version.
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
toolchain: "stable"
# The explicit cache below runs after lock removal and only saves on main.
cache: false
# Remove cargo.lock to force a fresh build
- name: Remove Cargo.lock
run: rm -f Cargo.lock
- uses: rui314/setup-mold@v1
- uses: Swatinem/rust-cache@v2
- uses: rui314/setup-mold@339e96b4ff1f3bd865856ba4cbbe8818a7acb038 # v1
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
# Restore everywhere, but only save from main. Per-PR saves are
# unreadable outside their own branch anyway, since GitHub scopes
@@ -203,7 +208,7 @@ jobs:
with:
fetch-depth: 0
lfs: true
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
# Restore everywhere, but only save from main. Per-PR saves are
# unreadable outside their own branch anyway, since GitHub scopes
@@ -213,7 +218,7 @@ jobs:
run: |
sudo apt update
sudo apt install -y protobuf-compiler libssl-dev
- uses: rui314/setup-mold@v1
- uses: rui314/setup-mold@339e96b4ff1f3bd865856ba4cbbe8818a7acb038 # v1
- name: Make Swap
run: |
swapfile=/swapfile
@@ -237,11 +242,11 @@ jobs:
sudo mkswap "$swapfile"
sudo swapon "$swapfile"
- name: Build
run: cargo build --profile ci --all-features --tests --locked --examples
run: cargo build --profile ci -p lancedb --all-features --tests --locked --examples
- name: Run feature tests
run: CARGO_ARGS="--profile ci" make -C ./lancedb feature-tests
- name: Run examples
run: cargo run --profile ci --all-features --example simple --locked
run: cargo run --profile ci -p lancedb --all-features --example simple --locked
- name: Run blob v2 docs example
# Python and TypeScript blob docs tests install preview packages.
# Those builds are not guaranteed to remain available for more than
@@ -275,7 +280,7 @@ jobs:
with:
fetch-depth: 0
lfs: true
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
# Remote tests use a different feature graph from the main Linux
# job. Cache downloads, but build into a fresh target directory.
@@ -285,17 +290,17 @@ jobs:
run: |
sudo apt update
sudo apt install -y protobuf-compiler libssl-dev
- uses: rui314/setup-mold@v1
- name: Test the default local Functions gate
run: cargo test --profile ci -p lancedb --features remote --test experimental_functions --locked
- uses: rui314/setup-mold@339e96b4ff1f3bd865856ba4cbbe8818a7acb038 # v1
- name: Run remote tests
run: CARGO_ARGS="--profile ci" make -C ./lancedb remote-tests
macos:
name: ${{ matrix.phase == 'tests' && format('macos ({0})', matrix.mac-runner) || format('macos-doc ({0})', matrix.mac-runner) }}
timeout-minutes: 60
strategy:
matrix:
mac-runner: ["macos-15", "macos-26"]
phase: [tests, doc]
runs-on: "${{ matrix.mac-runner }}"
defaults:
run:
@@ -306,10 +311,16 @@ jobs:
with:
fetch-depth: 0
lfs: true
- uses: actions/setup-python@v6
id: python
with:
python-version: "3.13"
- name: CPU features
run: sysctl -a | grep cpu
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
# PyO3 caches the interpreter library path; runner images can differ.
key: ${{ matrix.mac-runner }}-python-${{ steps.python.outputs.python-version }}
# Restore everywhere, but only save from main. Per-PR saves are
# unreadable outside their own branch anyway, since GitHub scopes
# caches to the creating ref.
@@ -317,16 +328,18 @@ jobs:
- name: Install dependencies
run: brew install protobuf
- name: Run tests
env:
PYO3_PYTHON: ${{ steps.python.outputs.python-path }}
CARGO_TEST_TARGETS: ${{ matrix.phase == 'doc' && '--doc' || '--lib --tests' }}
run: |
# Don't run the s3 integration tests since docker isn't available
# on this image.
ALL_FEATURES=`cargo metadata --format-version=1 --no-deps \
| jq -r '.packages[] | .features | keys | .[]' \
| grep -v s3-test | sort | uniq | paste -s -d "," -`
# Run doctests before test binaries fill the runner disk. Examples are
# already built by the Linux job, so avoid retaining them here.
cargo test --profile ci --features $ALL_FEATURES --locked --doc
cargo test --profile ci --features $ALL_FEATURES --locked --lib --tests
# Separate jobs give each phase its own time and disk budget. Examples
# are already built by the Linux job, so avoid retaining them here.
cargo test --profile ci --features $ALL_FEATURES --locked $CARGO_TEST_TARGETS
windows:
strategy:
@@ -341,9 +354,11 @@ jobs:
working-directory: rust/lancedb
steps:
- uses: actions/checkout@v6
- name: Enable long paths for Lance dependencies
run: git config --global core.longpaths true
- name: Set target
run: rustup target add ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
# Restore everywhere, but only save from main. Per-PR saves are
# unreadable outside their own branch anyway, since GitHub scopes
@@ -378,9 +393,11 @@ jobs:
working-directory: rust/lancedb
steps:
- uses: actions/checkout@v6
- name: Enable long paths for Lance dependencies
run: git config --global core.longpaths true
- name: Set target
run: rustup target add aarch64-pc-windows-msvc
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
# Restore everywhere, but only save from main. Per-PR saves are
# unreadable outside their own branch anyway, since GitHub scopes
@@ -420,10 +437,10 @@ jobs:
sudo apt update
sudo apt install -y protobuf-compiler libssl-dev
- name: Install ${{ matrix.msrv }}
uses: dtolnay/rust-toolchain@master
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
with:
toolchain: ${{ matrix.msrv }}
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
# Restore everywhere, but only save from main. Per-PR saves are
# unreadable outside their own branch anyway, since GitHub scopes
+27 -6
View File
@@ -1,6 +1,12 @@
LanceDB is a database designed for retrieval, including vector, full-text, and hybrid search.
It is a wrapper around Lance. There are two backends: local (in-process like SQLite) and
remote (against LanceDB Cloud).
It is a wrapper around Lance. There are two editions: LanceDB Embedded (in-process, like
SQLite) and LanceDB Enterprise (a server cluster reached over HTTP).
In user-facing text (docs, docstrings, error messages, examples), always say "Embedded"
and "Enterprise". Don't say "local" or "remote" tables. ("LanceDB Cloud" means only the
legacy hosted service, not Enterprise.) The code implements Enterprise in the `remote`
module, the `remote` cargo feature, and `Remote*` types. Those names are internal and
shouldn't leak into user-facing text.
The core of LanceDB is written in Rust. There are bindings in Python, Typescript, and Java.
@@ -72,9 +78,10 @@ back and fix it immediately if it is not conventional.
## Example plan: adding a new method on Table
Adding a new method involves first adding it to the Rust core, then exposing it
in the Python and TypeScript bindings. There are both local and remote tables.
Remote tables are implemented via a HTTP API and require the `remote` cargo
feature flag to be enabled. Python has both sync and async methods.
in the Python and TypeScript bindings. Every method needs an Embedded and an
Enterprise implementation. Enterprise tables are implemented via a HTTP API in the
`remote` module and require the `remote` cargo feature flag to be enabled. Python
has both sync and async methods.
Rust core changes:
@@ -104,7 +111,7 @@ TypeScript bindings changes:
2. Run `pnpm build` to generate TypeScript definitions.
3. Add typescript method on abstract class `Table` in `nodejs/lancedb/table.ts`.
4. Add concrete method on `LocalTable` class in `nodejs/lancedb/table.ts`.
* Note: despite the name, this class is also used for remote tables.
* Note: despite the name, this class is also used for Enterprise tables.
5. Add test in `nodejs/__test__/table.test.ts`.
6. Run `pnpm run docs` to generate TypeScript documentation.
@@ -155,3 +162,17 @@ Please consider the following when reviewing code contributions.
### Documentation
* New features must include updates to the rust documentation comments. Link to
relevant structs and methods to increase the value of documentation.
* User guides (`docs/web`) are evergreen: document only the current API. Don't add
migration tables or deprecation notices there. Mark deprecated APIs in their
docstrings, which feed the API reference.
### Breaking changes and deprecation
* Prefer deprecating over removing a released public API. When the new name differs
from the old one, keep the old one as a deprecated alias (`#[deprecated]` in Rust,
`DeprecationWarning` in Python, `@deprecated` in TypeScript), with a test that it
still works.
* Don't reuse a released public name for something with a different meaning. Callers
get a confusing error instead of a deprecation warning.
* For a breaking change, add `!` to the PR title and start the PR body with a
`BREAKING CHANGE:` paragraph covering the new behavior, the old behavior, and how to
migrate. Release notes are generated from it.
+23 -8
View File
@@ -109,12 +109,13 @@ npm i -g mint@4.2.888
This previews this checkout, including your uncommitted changes. It doesn't
include the other documentation sources or render the availability labels.
Use the [combined preview](https://github.com/lancedb/docs#development) when
checking Enterprise replacements or links to pages from another source.
Checking Enterprise replacements or links to pages from another source needs
the combined site, which maintainers build. Ask for that check in your pull
request if your change needs it.
Staging shows saved release editions, so it won't show a new source change
just because that change merged.
Follow the [style guide](https://github.com/lancedb/docs/blob/main/STYLE.md).
Follow the [style guide](docs/STYLE.md).
[Vale](https://vale.sh) checks wording, names and punctuation using the
[bundled LanceDB rules](.github/vale/README.md). Pull requests show suggestions
on the lines they change. With Vale 3.24.0 installed, check a page locally with:
@@ -182,15 +183,29 @@ You don't need to hold a documentation PR until launch. Use these controls:
comment below the table or list, not between entries.
Drafts remain in the source. Use them to avoid advertising an unfinished
feature, not to keep information confidential. See
[Writing docs before release](https://github.com/lancedb/docs#writing-docs-before-release)
for examples and how to preview a draft.
feature, not to keep information confidential. A draft section looks like
this:
```mdx
{/*
Draft for the Feature X release.
## Feature X {#feature-x}
Feature X does ...
*/}
```
Give the comment lines of its own, with a blank line before and after it. To
see how a draft renders, remove its comment or its `.mintignore` entry in a
local change you don't commit, then run `mint dev`.
Before the intended release, remove the draft controls, restore the navigation
and links, and check the result. Those changes must be in the source commit the
edition uses. A later change to `main` doesn't update an edition already saved.
For a mistake in an existing edition, fix the source and request a
[recorded correction](https://github.com/lancedb/docs#correcting-a-saved-edition).
For a mistake in an existing edition, fix the source and say in the pull
request which editions have the error. A maintainer corrects the saved
editions.
## Release process
Generated
+822 -627
View File
File diff suppressed because it is too large Load Diff
+16 -17
View File
@@ -19,21 +19,21 @@ categories = ["database-implementations"]
rust-version = "1.95.0"
[workspace.dependencies]
lance = { "version" = "=15.0.0-beta.9", default-features = false, "tag" = "v15.0.0-beta.9", "git" = "https://github.com/lance-format/lance.git" }
lance-core = { "version" = "=15.0.0-beta.9", "tag" = "v15.0.0-beta.9", "git" = "https://github.com/lance-format/lance.git" }
lance-datagen = { "version" = "=15.0.0-beta.9", "tag" = "v15.0.0-beta.9", "git" = "https://github.com/lance-format/lance.git" }
lance-file = { "version" = "=15.0.0-beta.9", "tag" = "v15.0.0-beta.9", "git" = "https://github.com/lance-format/lance.git" }
lance-io = { "version" = "=15.0.0-beta.9", default-features = false, "tag" = "v15.0.0-beta.9", "git" = "https://github.com/lance-format/lance.git" }
lance-index = { "version" = "=15.0.0-beta.9", "tag" = "v15.0.0-beta.9", "git" = "https://github.com/lance-format/lance.git" }
lance-jsonb = { "version" = "=15.0.0-beta.9", "tag" = "v15.0.0-beta.9", "git" = "https://github.com/lance-format/lance.git" }
lance-linalg = { "version" = "=15.0.0-beta.9", "tag" = "v15.0.0-beta.9", "git" = "https://github.com/lance-format/lance.git" }
lance-namespace = { "version" = "=15.0.0-beta.9", "tag" = "v15.0.0-beta.9", "git" = "https://github.com/lance-format/lance.git" }
lance-namespace-impls = { "version" = "=15.0.0-beta.9", default-features = false, "tag" = "v15.0.0-beta.9", "git" = "https://github.com/lance-format/lance.git" }
lance-table = { "version" = "=15.0.0-beta.9", "tag" = "v15.0.0-beta.9", "git" = "https://github.com/lance-format/lance.git" }
lance-testing = { "version" = "=15.0.0-beta.9", "tag" = "v15.0.0-beta.9", "git" = "https://github.com/lance-format/lance.git" }
lance-datafusion = { "version" = "=15.0.0-beta.9", "tag" = "v15.0.0-beta.9", "git" = "https://github.com/lance-format/lance.git" }
lance-encoding = { "version" = "=15.0.0-beta.9", "tag" = "v15.0.0-beta.9", "git" = "https://github.com/lance-format/lance.git" }
lance-arrow = { "version" = "=15.0.0-beta.9", "tag" = "v15.0.0-beta.9", "git" = "https://github.com/lance-format/lance.git" }
lance = { "version" = "=15.0.0-beta.25", default-features = false, "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-core = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-datagen = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-file = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-io = { "version" = "=15.0.0-beta.25", default-features = false, "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-index = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-jsonb = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-linalg = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-namespace = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-namespace-impls = { "version" = "=15.0.0-beta.25", default-features = false, "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-table = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-testing = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-datafusion = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-encoding = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lance-arrow = { "version" = "=15.0.0-beta.25", "tag" = "v15.0.0-beta.25", "git" = "https://github.com/lance-format/lance.git" }
lancedb = { path = "rust/lancedb", default-features = false }
ahash = "0.8"
anyhow = "1"
@@ -49,8 +49,7 @@ arrow-select = "59.2.0"
arrow-cast = "59.2.0"
arrow-flight = { version = "59.2.0", features = ["flight-sql-experimental"] }
async-trait = "0"
# Smithy JSON 0.63 requires the pre-1.7 Document representation; allow the MSRV pin.
aws-smithy-types = ">=1.3.6, <1.7"
aws-smithy-types = "1.9.1"
base64 = "0.22"
bytes = "1"
datafusion = { version = "55.0.0", default-features = false }
+15 -2
View File
@@ -20,7 +20,20 @@ parity gaps when reviewing — but only flag real ones:
* Stay silent on internal-only refactors, tests, docs, and changes with no cross-SDK
surface.
* Parity expectations apply to the Python and TypeScript (`nodejs`) SDKs. Java currently
implements only the remote table, not the local/embedded backend, so it is expected to
be partial — do not flag Java for missing local-only functionality.
implements only Enterprise tables, not the Embedded backend, so it is expected to
be partial — do not flag Java for missing Embedded-only functionality.
* Keep parity feedback to a short, clearly-labeled note (e.g. "Possible SDK parity
gap: …"). It is advisory, not a merge blocker.
## User-facing text and API compatibility
Check new user-facing text and public API changes against the rules in `AGENTS.md`:
* Docs, docstrings, error messages, and examples say "Embedded" and "Enterprise", not
"local" or "remote" tables.
* Released public APIs are deprecated rather than removed, and released names are not
reused for something with a different meaning.
* User guides (`docs/web`) document only the current API, with no migration or
deprecation notices.
* Breaking changes have `!` in the PR title and a `BREAKING CHANGE:` paragraph at the
top of the PR body.
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -54,6 +54,7 @@ def main() -> int:
["cargo", "metadata", "--format-version=1", "--no-deps", "--all-features"],
stdout=subprocess.PIPE,
text=True,
check=False,
)
if metadata.returncode:
return metadata.returncode
@@ -68,7 +69,7 @@ def main() -> int:
"--tests",
# Bound simultaneous compiler/linker temporary outputs as well as retained files.
"--jobs",
"1",
"2",
"--message-format=json,json-diagnostic-rendered-ansi",
]
cleanup_failed = False
+5 -3
View File
@@ -88,9 +88,11 @@ class BuildNoLockTest(unittest.TestCase):
self.assertTrue((target / "fixture_cli").is_file())
# Cargo guarantees this binary for test execution, not compile-time reads.
subprocess.run([str(target / "fixture_cli")], check=True)
self.assertTrue(list((target / "deps").glob("libartifact_fixture*.rlib")))
self.assertTrue(list((target / "build").glob("*/build-script-build")))
self.assertTrue(list((target / "build").glob("*/out/generated.rs")))
# Cargo 1.100 nests compiler inputs in per-unit build directories and
# names the build-script executable build_script_build.
self.assertTrue(list(target.rglob("libartifact_fixture*.rlib")))
self.assertTrue(list((target / "build").rglob("build[-_]script[-_]build")))
self.assertTrue(list((target / "build").rglob("out/generated.rs")))
def test_link_failure_preserves_cargo_status_and_diagnostic(self):
with tempfile.TemporaryDirectory(prefix=".no-lock-", dir=SCRIPT.parent) as temp:
+42
View File
@@ -0,0 +1,42 @@
#!/bin/sh
# Run from repository root. The fake transport serves a deliberately corrupt archive.
set -eu
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
export HOME="$work/home" LANCEDB_VERSION=v0.42.0-beta.19
unset LANCEDB_INSTALL_DIR
mkdir -p "$work/bin" "$HOME"
export PATH="$work/bin:$PATH"
cat > "$work/bin/curl" <<'MOCK'
#!/bin/sh
while [ "$1" != -o ]; do shift; done
case "$3" in
*/SHA256SUMS)
for target in x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu aarch64-apple-darwin; do
printf '%064d lancedb-%s-%s.tar.gz\n' 0 "$LANCEDB_VERSION" "$target"
done > "$2" ;;
*) printf 'corrupt archive' > "$2" ;;
esac
MOCK
chmod +x "$work/bin/curl"
reject() {
if sh scripts/install.sh > "$work/log" 2>&1; then
echo "Unexpected install success" >&2
exit 1
fi
grep -F "$1" "$work/log"
}
printf 'existing admin CLI\n' > "$work/bin/lancedb"
chmod +x "$work/bin/lancedb"
reject 'on PATH'
test ! -e "$HOME/.local/bin/lancedb"
export LANCEDB_INSTALL_DIR="$work/separate bin"
mkdir -p "$LANCEDB_INSTALL_DIR"
ln -s "$work/bin/lancedb" "$LANCEDB_INSTALL_DIR/lancedb"
reject 'already exists'
test -L "$LANCEDB_INSTALL_DIR/lancedb"
rm "$LANCEDB_INSTALL_DIR/lancedb"
reject 'Checksum mismatch'
test -z "$(ls -A "$LANCEDB_INSTALL_DIR")"
test "$(cat "$work/bin/lancedb")" = 'existing admin CLI'
+1 -1
View File
@@ -27,7 +27,7 @@ class TestExtractSdkDocLinks(unittest.TestCase):
urls,
)
self.assertIn(
"https://docs.lancedb.com/enterprise",
"https://docs.lancedb.com/basics/embedded-vs-enterprise",
urls,
)
+26
View File
@@ -131,6 +131,32 @@ ignore = [
{ id = "RUSTSEC-2026-0391", reason = "zstd 0.13 via arrow-ipc 58; affected with_context API is unused" },
{ id = "RUSTSEC-2026-0398", reason = "zstd-safe 7 via arrow-ipc 58; affected seekable API is not enabled" },
{ id = "RUSTSEC-2026-0403", reason = "zstd-safe 7 via arrow-ipc 58; affected streaming decoder API is unused" },
# pin-utils: unmaintained; reviewed 2026-11-05, removed 2026-11-17 after
# the lockfile dropped the aws-smithy pins that carried it.
# https://rustsec.org/advisories/RUSTSEC-2026-0441
# chrono: unmaintained; reviewed 2026-11-17. Informational notice, not a
# vulnerability. Transitive via arrow 59 / datafusion 55 and the lance
# stack throughout the workspace. RustSec lists no patched version and
# recommends jiff/time; clearing it requires the arrow/datafusion/lance
# ecosystem to migrate.
# https://rustsec.org/advisories/RUSTSEC-2026-0543
{ id = "RUSTSEC-2026-0543", reason = "chrono unmaintained via arrow/datafusion/lance; no fixed upstream release, awaiting ecosystem migration" },
# chrono-tz: unmaintained; reviewed 2026-11-17. Informational notice, not
# a vulnerability. Transitive via arrow-array → arrow → datafusion/lance.
# No patched version exists; clearing it needs the same ecosystem
# migration off chrono as RUSTSEC-2026-0543.
# https://rustsec.org/advisories/RUSTSEC-2026-0555
{ id = "RUSTSEC-2026-0555", reason = "chrono-tz unmaintained via arrow/datafusion/lance; no fixed upstream release" },
# humantime: unmaintained; reviewed 2026-11-17. Informational notice, not
# a vulnerability. Transitive via lance, object_store (through datafusion)
# and xet-runtime. No patched version exists; the advisory follows chrono's
# maintenance status.
# https://rustsec.org/advisories/RUSTSEC-2026-0542
{ id = "RUSTSEC-2026-0542", reason = "humantime unmaintained via lance/object_store/xet-runtime; no fixed upstream release" },
]
+6 -23
View File
@@ -1,27 +1,10 @@
# Simple base dockerfile that supports basic dependencies required to run lance with FTS and Hybrid Search
# Simple base dockerfile for running LanceDB, including FTS and Hybrid Search
# Usage: docker build -t lancedb:latest -f Dockerfile .
FROM python:3.12-slim-bookworm
# Install build dependencies in a single layer
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
build-essential \
protobuf-compiler \
git \
ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install Rust (pinned installer, non-interactive)
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal
# Set the environment variable for Rust
ENV PATH="/root/.cargo/bin:${PATH}"
# Verify installations
RUN python --version && \
rustc --version && \
protoc --version
# lancedb ships prebuilt manylinux wheels, so no Rust or C toolchain is needed.
RUN pip install --no-cache-dir lancedb
RUN useradd --create-home --uid 1000 lancedb
USER lancedb
WORKDIR /home/lancedb
+148
View File
@@ -0,0 +1,148 @@
# LanceDB documentation style
Write for developers who want to understand LanceDB and get something done.
Be direct, approachable and technically precise. Give readers enough context
to make a decision, then show them how to act on it.
This guide covers prose on docs.lancedb.com: the pages in this repository's
`docs/web`, including the public Enterprise pages, and the Geneva, dataset and
REST pages kept in other sources. The
[contributing guide](../CONTRIBUTING.md#documentation) covers previewing,
code examples and availability labels.
## Start with the reader's goal
Open with what the feature does and when to use it. Keep the introduction
short. Put prerequisites before the instructions that need them, and explain
limitations beside the choice or operation they affect.
Show the common path before advanced options. A guide should get readers to a
useful result before asking them to compare every configuration. This is a
default, not a required outline for every page.
## Give each page a purpose
A concept page explains a few central ideas and how they relate. A guide helps
readers complete a task. A reference describes exact syntax, options and
behavior. Link to related material with descriptive link text instead of
making every page cover all three roles.
Keep each section focused on the page's purpose. Don't add a conclusion or a
next-steps section unless it helps the reader decide what to do next.
## Teach through examples
Use small datasets, meaningful names and examples that build on each other.
Include the imports, setup and prerequisites readers need, or clearly link to
shared setup. State when successive blocks belong to one program. Show the
expected result when it helps readers understand the operation.
Where equivalent SDK support exists, show Python, TypeScript and Rust
consistently. Use the same task and sample data across languages, with
idiomatic code in each. If support differs, explain the difference beside the
example; don't invent an equivalent API. Prefer fresh example data and make
any destructive behavior explicit.
Explain what an example demonstrates or why an option matters. Avoid narrating
every line when the code already makes its meaning clear.
## Explain choices and consequences
Tell readers when to choose an option and what changes when they do. State the
relevant tradeoff, such as latency versus recall, rather than listing settings
without guidance. Use a table when it makes alternatives easier to compare.
Name the product or component whose behavior you describe. Use LanceDB
Enterprise when you mean the offering; use deployment when you mean a
particular installation or its configuration. Describe concrete capabilities
and benefits without unsupported performance claims or superlatives.
## Say it directly
Address the reader as "you" and prefer active verbs and familiar words.
Introduce unfamiliar terms when readers first need them. Prefer "use" to
"utilize" and "to" to "in order to". Keep technical terms precise: "GPU
utilization", for example, has a specific meaning and does not need replacing.
Describe the subject, not the page or the writing. Instead of "This page is the
concept; the SQL reference is the specification", explain the concept and
link to the reference. Instead of opening with "That matters", state the
consequence. Avoid "simply" and "obviously" when they assume a task is easy for
the reader. These are writing guidelines, not blanket bans on individual words.
## Headings
A heading names the task or topic of its section. "Then what" doesn't; "Choose
an output" does. Prefer specific headings such as "Data durability" to broad
questions such as "What survives?". Use sentence case, preserving product names
and identifiers.
## Names
Write product names exactly: LanceDB, LanceDB Embedded and LanceDB Enterprise.
Write other names as their owners do, such as Hugging Face, LangChain,
TypeScript and Voyage AI.
- **LanceDB Embedded** is the in-process execution model: the SDK runs
database operations inside the application's process and reads Lance tables
directly, from local disk or object storage. Don't write "LanceDB OSS",
"LanceDB Local" or "local mode".
- **LanceDB Enterprise** is the commercial product. Use this name in product
descriptions, SDK documentation and architecture explanations: "a LanceDB
SDK connects to LanceDB Enterprise". Describe execution directly: query
execution, indexing, caching and maintenance run on the service, outside
the application. Write "Embedded and Enterprise" when comparing offerings.
Don't introduce "LanceDB Distributed" as another name for the product or
its execution model. Lowercase "distributed" still describes how a feature
works, such as distributed search, caching or training. Use "Enterprise
table" or "Enterprise connection" in prose; keep API identifiers such as
`RemoteTable` unchanged.
- **LanceDB Cloud** is only the legacy hosted service. Keep it where text is
specific to that service, such as `db://` URIs with an `api_key` and
`region`; otherwise write LanceDB Enterprise.
- **Open source** is a property, not a product: "the open-source LanceDB SDKs",
"Lance is open source". Where free versus paid is the point, write "LanceDB
Embedded (open source)" and "LanceDB Enterprise". Don't use "OSS" as a
product name, as in "OSS vs Enterprise".
- Internal component names stay out of public text. Write "query node",
"executor" and LanceDB Enterprise instead; the `InternalNames` Vale rule
lists the names it catches. Geneva is a product name and stays as is.
Package, module, class and repository names are code, so put them in code
font: `lancedb`, `pyarrow`, `HuggingFaceEmbeddings`.
## Punctuation
Don't use em dashes in prose, or a double hyphen or spaced en dash in place of
one. Use a comma, a colon, parentheses or two sentences. An en dash in a range,
such as 1–3, is fine, and so is a table cell that holds only an em dash to mean
"none".
## Automated checks and review
[Vale](https://vale.sh) checks a small subset of these conventions: product
names, dashes, repeated words, a few vague phrases and headings, and a few
plain-language substitutions. Findings are advisory and appear on changed
lines; they never fail the check. Installation or configuration failures can
still fail it. See the [bundled rules](../.github/vale/README.md) for usage and tests.
Vale cannot verify technical claims, example correctness, SDK coverage or a
page's organization. Review those using implementation evidence, tests and
feature-owner input. Confirm availability and release status with the owner;
do not infer a release promise from an implementation or a passing test.
Reader-visible component titles and captions in MDX attributes are also left
to review because Vale does not inspect those attributes.
Use these guidelines as defaults. Reviewers can make exceptions when they
improve clarity or accuracy.
## Exceptions
When a sentence must break an automated rule, such as a quoted error message,
switch off that rule around it and say why in the pull request:
```mdx
{/* vale LanceDB.Dashes = NO */}
The server returns "Table not found — check the name".
{/* vale LanceDB.Dashes = YES */}
```
+1 -1
View File
@@ -14,7 +14,7 @@ Add the following dependency to your `pom.xml`:
<dependency>
<groupId>com.lancedb</groupId>
<artifactId>lancedb-core</artifactId>
<version>0.42.0-beta.4</version>
<version>0.42.0-beta.20</version>
</dependency>
```
+12 -8
View File
@@ -456,7 +456,7 @@ Rejects a table that exists but is not a materialized view.
### dropMaterializedViewAsync()
```ts
abstract dropMaterializedViewAsync(name, namespacePath?): Promise<Job>
abstract dropMaterializedViewAsync(name, namespacePath?): Promise<Job<void>>
```
Start dropping the materialized view named `name` and return its job.
@@ -473,7 +473,7 @@ Rejects a table that exists but is not a materialized view.
#### Returns
`Promise`&lt;[`Job`](Job.md)&gt;
`Promise`&lt;[`Job`](Job.md)&lt;`void`&gt;&gt;
***
@@ -532,7 +532,7 @@ Drop an existing table.
### dropTableAsync()
```ts
abstract dropTableAsync(name, namespacePath?): Promise<Job>
abstract dropTableAsync(name, namespacePath?): Promise<Job<void>>
```
Start dropping a table and return its cleanup job.
@@ -548,7 +548,7 @@ on the returned job to know when cleanup has finished.
#### Returns
`Promise`&lt;[`Job`](Job.md)&gt;
`Promise`&lt;[`Job`](Job.md)&lt;`void`&gt;&gt;
***
@@ -579,7 +579,7 @@ catalog removal; physical cleanup continues in the background.
### dropViewAsync()
```ts
abstract dropViewAsync(name, namespacePath?): Promise<Job>
abstract dropViewAsync(name, namespacePath?): Promise<Job<void>>
```
Drop a view and return its SQL query job.
@@ -594,7 +594,7 @@ catalog removal; physical cleanup continues in the background.
#### Returns
`Promise`&lt;[`Job`](Job.md)&gt;
`Promise`&lt;[`Job`](Job.md)&lt;`void`&gt;&gt;
***
@@ -729,7 +729,7 @@ state and error behavior; options control page size and the starting token.
### openJob()
```ts
abstract openJob(jobId): Promise<Job>
abstract openJob<T>(jobId): Promise<Job<T>>
```
Open a server-side job by id, returning a handle with its record already
@@ -740,13 +740,17 @@ The returned [Job](Job.md) answers for its own state, specification,
result, failure and event history, so there is no separate
connection-level call for any of them.
#### Type Parameters
• **T** = `void`
#### Parameters
* **jobId**: `string`
#### Returns
`Promise`&lt;[`Job`](Job.md)&gt;
`Promise`&lt;[`Job`](Job.md)&lt;`T`&gt;&gt;
***
+48
View File
@@ -258,3 +258,51 @@ using an underlying bitmap index.
#### Returns
[`Index`](Index.md)
***
### rtree()
```ts
static rtree(options?): Index
```
Create an RTree index.
An RTree index is a scalar index on a GeoArrow geometry column, that is, a
column whose Arrow field metadata sets `ARROW:extension:name` to a GeoArrow
type such as `geoarrow.point`, `geoarrow.polygon` or `geoarrow.wkb`. It
stores the bounding box of each geometry and accelerates spatial filters.
The index accelerates `ST_Intersects`, `ST_Contains`, `ST_Within`,
`ST_Touches`, `ST_Crosses`, `ST_Overlaps`, `ST_Covers` and `ST_CoveredBy`
between the indexed column and a constant geometry, in either argument
order, for example
`ST_Within(geom, ST_GeomFromText('POLYGON ((...))'))`, as well as
`geom IS NULL`. These filters can be combined with other conditions using
`AND`.
See the R-tree section of https://docs.lancedb.com/indexing/scalar-index
for storing geometry, the other spatial functions, and spatial filters on
vector search.
Remote tables send the `RTREE` index type to the server, which must
support it.
#### Parameters
* **options?**: `Partial`&lt;[`RTreeOptions`](../interfaces/RTreeOptions.md)&gt;
#### Returns
[`Index`](Index.md)
#### Example
```ts
await table.createIndex("geom", { config: Index.rtree() });
await table
.query()
.where("ST_Intersects(geom, ST_GeomFromText('POLYGON ((0 0, 4 0, 0 4, 0 0))'))")
.toArray();
```
+19 -4
View File
@@ -4,7 +4,7 @@
[@lancedb/lancedb](../globals.md) / Job
# Class: Job
# Class: Job&lt;T&gt;
A handle to an operation that may still be running.
@@ -20,6 +20,10 @@ extra round trip on every call:
- Registry details are null until one of those runs. Query handles report
jobType "query" immediately.
## Type Parameters
• **T** = `void`
## Accessors
### creationMs
@@ -241,7 +245,7 @@ printing it.
### wait()
```ts
wait(progressCallback?): Promise<void>
wait(optionsOrProgress?): Promise<T>
```
Wait until the operation reaches a terminal state.
@@ -253,10 +257,21 @@ synchronous observer: its return value is ignored and not awaited. If it
throws, the error is logged with `console.warn` and waiting continues; a
callback exception does not reject `wait`.
Pass an options object to set a client-side timeout. Expiry rejects with an
error and stops this wait, including pending status requests and backoff.
The operation continues; use the same handle to wait again. Registry jobs
can also be reopened with `Connection.openJob`; query IDs cannot.
#### Parameters
* **progressCallback?**: [`JobProgressCallback`](../type-aliases/JobProgressCallback.md)
* **optionsOrProgress?**: [`JobWaitOptions`](../interfaces/JobWaitOptions.md) \| [`JobProgressCallback`](../type-aliases/JobProgressCallback.md)
#### Returns
`Promise`&lt;`void`&gt;
`Promise`&lt;`T`&gt;
#### Example
```ts
const result = await job.wait({ timeoutMs: 60_000, onProgress: console.log });
```
+386 -19
View File
@@ -305,6 +305,40 @@ It is a no-op when no writers are cached.
***
### compactAsync()
```ts
compactAsync(_options?): Promise<Job<CompactionResult>>
```
Submit remote compaction and return its durable job after acceptance.
Uses SQL OPTIMIZE, inheriting branch and namespace from this table. Requires
a compatible remote server and table Ownership plus parent Usage. Local and
historical-version handles are unsupported. Existing optimize() behavior is unchanged.
Waiting tracks the rewrite itself and returns actual row/file statistics.
Missing result payloads are errors; older workers can omit file counts.
Status, progress, events and cancellation reuse the generic HTTP job APIs.
Reopen with db.openJob<CompactionResult>(job.id!). A wait timeout does not cancel work.
#### Parameters
* **\_options?**: [`CompactionOptions`](../interfaces/CompactionOptions.md)
#### Returns
`Promise`&lt;[`Job`](Job.md)&lt;[`CompactionResult`](../interfaces/CompactionResult.md)&gt;&gt;
#### Example
```ts
const job = await table.compactAsync({ targetRowsPerFragment: 1000 });
const result = await job.wait();
console.log(result.rowsSucceeded, result.fragmentsRemoved);
```
***
### compactRTE()
```ts
@@ -423,7 +457,7 @@ await table.createIndex("my_float_col");
### createIndexAsync()
```ts
abstract createIndexAsync(column, options?): Promise<Job>
abstract createIndexAsync(column, options?): Promise<Job<void>>
```
Create an index, returning a handle to the indexing job.
@@ -444,7 +478,7 @@ account for the replacement caveat described in [Table.createIndex](Table.md#cre
#### Returns
`Promise`&lt;[`Job`](Job.md)&gt;
`Promise`&lt;[`Job`](Job.md)&lt;`void`&gt;&gt;
***
@@ -619,6 +653,40 @@ await table.enableRTE({
***
### explainPrewarmData()
```ts
explainPrewarmData(_options?): Promise<PrewarmDataPlan>
```
Preview prewarm with the same options as [prewarmDataAsync](Table.md#prewarmdataasync), without
submitting a warming job. Requires LanceDB Enterprise with structured SQL
previews, table Select and database/namespace Usage. Reads metadata and
returns the source version, readable plan, and conservative pruning summary.
A later submission plans its own snapshot. Historical and Embedded handles
are unsupported. Unknown measurements remain null.
Custom table implementations can override this method; its default rejects
with an unsupported-operation error.
#### Parameters
* **\_options?**: [`PrewarmDataOptions`](../interfaces/PrewarmDataOptions.md)
#### Returns
`Promise`&lt;[`PrewarmDataPlan`](../interfaces/PrewarmDataPlan.md)&gt;
#### Example
```ts
const plan = await table.explainPrewarmData({
columns: ["video"], filter: "quality > $minimum", parameters: {minimum: 0.7},
});
console.log(plan.pruning.selectedFragments);
```
***
### fetchBlobFiles()
```ts
@@ -650,6 +718,48 @@ tables; no partial handles are returned.
***
### fetchBlobRanges()
```ts
abstract fetchBlobRanges(
column,
requests,
options?): Promise<(null | Buffer)[]>
```
Materializes row-specific byte ranges at the table's current checkout.
Preserves request order, duplicates, and nulls. Zero length returns an empty
buffer for a non-null blob. Invalid ranges or missing rows reject the entire
call. See [Table.fetchBlobs](Table.md#fetchblobs) for row-ID validity across versions.
Remote tables use the batched endpoint when the server advertises support,
splitting at 1024 ranges and 64 MiB, including individual larger ranges.
Older servers use descriptor queries and BlobFile range reads. Both protocols
use one exact branch and version. Errors from an advertised endpoint propagate
without switching protocols. All output bytes occupy memory.
#### Parameters
* **column**: `string`
* **requests**: readonly [`BlobRangeRequest`](../type-aliases/BlobRangeRequest.md)[]
* **options?**: [`BlobReadOptions`](../type-aliases/BlobReadOptions.md)
#### Returns
`Promise`&lt;(`null` \| `Buffer`)[]&gt;
#### Example
```ts
const bytes = await table.fetchBlobRanges("image", [
{ rowId: 10n, offset: 0n, length: 1024n },
]);
```
***
### fetchBlobs()
```ts
@@ -704,6 +814,47 @@ so this is safe to call repeatedly.
***
### functionColumnStatus()
```ts
abstract functionColumnStatus(column): Promise<FunctionColumnStatus>
```
Return exact freshness status for one Function-backed output column.
#### Parameters
* **column**: `string`
#### Returns
`Promise`&lt;[`FunctionColumnStatus`](../interfaces/FunctionColumnStatus.md)&gt;
***
### functionColumnStatuses()
```ts
abstract functionColumnStatuses(column?): Promise<FunctionColumnStatus[]>
```
Return exact freshness status for Function-backed output columns.
All results describe one server table version. Omit `column` for every
Function output. Rows already failed remain visible and do not prevent
`waitFresh` from completing. A handle pinned to an exact version requests
that version; a latest handle retains normal read-freshness behavior.
#### Parameters
* **column?**: `string`
#### Returns
`Promise`&lt;[`FunctionColumnStatus`](../interfaces/FunctionColumnStatus.md)[]&gt;
***
### functionErrors()
```ts
@@ -784,6 +935,26 @@ Resolves to `undefined` only when the RTE write path is not enabled.
***
### getTableOverrides()
```ts
getTableOverrides(): Promise<Record<string, unknown>>
```
Read the stored overrides for a remote Enterprise table.
Overrides configure background behavior such as automatic compaction,
cleanup, and reindex execution. Keys use the server's snake_case names.
Returns an empty object when no overrides are set. Local tables are unsupported.
Custom table implementations inherit a default rejection unless they override
this method.
#### Returns
`Promise`&lt;`Record`&lt;`string`, `unknown`&gt;&gt;
***
### indexStats()
```ts
@@ -948,6 +1119,9 @@ supported. Pruning old versions and index optimization are silently
skipped there instead of being attempted, so this call resolves
successfully, with zeroed pruning statistics, once the compaction job
has been submitted; it does not wait for that job to finish.
`compactionOptions` can tune the four per-job settings documented in
[CompactionOptions](../interfaces/CompactionOptions.md). Older-server errors are propagated without
retrying with the settings removed.
#### Parameters
@@ -961,29 +1135,99 @@ has been submitted; it does not wait for that job to finish.
### prewarmData()
#### prewarmData(options)
```ts
abstract prewarmData(columns?): Promise<void>
abstract prewarmData(options?): Promise<void>
```
Prewarm one or more columns of data in the table.
#### Parameters
This will load the column data into the page cache so that future queries that
read those columns avoid the initial cold-start latency. This call initiates
prewarming and returns once the request is accepted; the warming itself may
continue in the background. Submission uses SQL PREWARM and needs Flight
SQL connectivity. Use [prewarmDataAsync](Table.md#prewarmdataasync) to retain the job handle.
Prewarming is generally useful for columns used in filters or projections.
Large columns (e.g. high-dimensional vectors or binary data) may not be
practical to prewarm.
This feature is currently only supported in LanceDB Enterprise.
##### Parameters
* **options?**: [`PrewarmDataOptions`](../interfaces/PrewarmDataOptions.md)
Columns, a metadata-pruning filter, and per-executor concurrency.
Omitted or empty columns warm every column.
##### Returns
`Promise`&lt;`void`&gt;
##### Example
```ts
await table.prewarmData({
columns: ["payload"], filter: "quality > 0.7", concurrency: 4,
});
```
#### prewarmData(columns)
```ts
abstract prewarmData(columns?): Promise<void>
```
Submit data prewarm using the columns-array form and return after acceptance.
##### Parameters
* **columns?**: `string`[]
The columns to prewarm. If undefined, all columns are prewarmed.
This will load the column data into the page cache so that future queries that
read those columns avoid the initial cold-start latency. This call initiates
prewarming and returns once the request is accepted; the warming itself may
continue in the background. Calling it on already-prewarmed columns is a
no-op on the server.
Prewarming is generally useful for columns used in filters or projections.
Large columns (e.g. high-dimensional vectors or binary data) may not be
practical to prewarm.
This feature is currently only supported in LanceDB Enterprise.
Columns to warm; omitted or empty means every column.
##### Returns
`Promise`&lt;`void`&gt;
***
### prewarmDataAsync()
```ts
abstract prewarmDataAsync(options?): Promise<Job<PrewarmDataResult>>
```
Submit data prewarm through SQL and return its durable warming-job handle.
The table handle supplies the branch and namespace. Requires a compatible
SQL PREWARM server and Flight SQL connectivity. Standard authorization
requires table Select and database/namespace Usage. Status/wait use generic
HTTP job APIs; events and cancellation retain their own privileges.
No REST fallback or option-dropping retry is performed. Historical-version
handles are unsupported; call `checkoutLatest()` first.
Submission returns after acceptance. Use `job.wait()` for completion, or
save `job.id` and reopen it with `db.openJob(id)`. A timeout does not cancel
the job. After `job.refresh()`, `job.spec.table_version` is the pinned version.
#### Parameters
* **options?**: [`PrewarmDataOptions`](../interfaces/PrewarmDataOptions.md)
#### Returns
`Promise`&lt;`void`&gt;
`Promise`&lt;[`Job`](Job.md)&lt;[`PrewarmDataResult`](../interfaces/PrewarmDataResult.md)&gt;&gt;
#### Example
```ts
const job = await table.prewarmDataAsync({
columns: ["video"], filter: "quality > $minimum",
parameters: { minimum: 0.7 }, concurrency: 4,
});
await job.wait();
```
***
@@ -1082,7 +1326,7 @@ for await (const batch of table.query()) {
### refreshColumn()
```ts
abstract refreshColumn(column): Promise<RefreshColumnResult>
abstract refreshColumn(column, options?): Promise<RefreshColumnResult>
```
Fill the rows of a computed column that hold no value yet.
@@ -1098,6 +1342,10 @@ Enterprise a refresh runs as a server job, through [Table#refreshColumnAsync](Ta
* **column**: `string`
The name of the computed column to fill.
* **options?**: [`RefreshColumnOptions`](../interfaces/RefreshColumnOptions.md)
Refresh options, all LanceDB
Enterprise only; see [Table#refreshColumnAsync](Table.md#refreshcolumnasync).
#### Returns
`Promise`&lt;[`RefreshColumnResult`](../interfaces/RefreshColumnResult.md)&gt;
@@ -1110,7 +1358,7 @@ number of rows filled and the new version number of the table.
### refreshColumnAsync()
```ts
abstract refreshColumnAsync(column): Promise<Job>
abstract refreshColumnAsync(column, options?): Promise<Job<void>>
```
Like [Table#refreshColumn](Table.md#refreshcolumn), but returns a handle to the refresh
@@ -1130,20 +1378,78 @@ LanceDB Enterprise it is the server's backfill job.
* **column**: `string`
The name of the computed column to fill.
* **options?**: [`RefreshColumnOptions`](../interfaces/RefreshColumnOptions.md)
Refresh options, mirroring the SQL
`REFRESH COLUMN ... WHERE ... WITH (...)` form: `where` narrows the rows,
`errorPolicy`, `maxFailedFraction`, `maxFailedRows`, `rowTimeoutSeconds`
and `initTimeoutSeconds` govern failing rows. `batchSize`, `gpuClass`,
`maxConcurrency`, `resourceBudget`, `supervisorResources`,
`planningWorkers` and `maxExecutorProcessesPerWorker` size registered
Function refreshes. `retryPolicy` overrides user-code retries only when
repeating partial work is safe; set `maxAttempts: 1` to disable retries.
`maxConcurrency` overrides the registered default for this logical
execution only and is a positive integer; it is not an account-wide
quota. A `resourceBudget` requires `cpuMillis` and
`memoryBytes`; its `gpuCount` defaults to zero for a CPU-only Function.
`supervisorResources` and each `planningWorkers.resources` entry require
positive `cpuMillis`, `memoryBytes` and `ephemeralStorageBytes`.
`planningWorkers` also requires positive `maxWorkers`,
`rowsPerWorker` and `fragmentsPerWorker`.
The budget applies only to this explicit refresh and does not configure
a later automatic refresh.
`gpuCount` at the top level is the shorthand that preserves the
deployment defaults for CPU and memory, and cannot be combined with
`resourceBudget`. `numWorkers` applies only to expression columns; use
`resourceBudget` for registered Functions. All are LanceDB Enterprise
only; a LanceDB Embedded refresh rejects every option other than
`batchSize`, `gpuClass` and `gpuCount`.
`publicationIntervalRows` opts into publishing completed Function split
ranges once their accumulated unpublished rows reach the threshold.
It must be a positive safe integer and requires non-Blob Function outputs.
Omit it for whole-fragment publication. Publications can exceed the
threshold, and remaining rows publish at completion.
#### Returns
`Promise`&lt;[`Job`](Job.md)&gt;
`Promise`&lt;[`Job`](Job.md)&lt;`void`&gt;&gt;
#### Example
```ts
const job = await table.refreshColumnAsync("doubled");
const job = await table.refreshColumnAsync("embedding", {
where: "published_at > '2026-01-01'",
resourceBudget: {
cpuMillis: 8000,
memoryBytes: 16 * 1024 ** 3,
},
maxConcurrency: 4,
publicationIntervalRows: 10000,
errorPolicy: "skip",
maxFailedFraction: 0.01,
rowTimeoutSeconds: 30,
});
await job.wait();
console.log(await job.status()); // "finished"
```
***
### resetTableOverrides()
```ts
resetTableOverrides(): Promise<Record<string, unknown>>
```
Clear a remote Enterprise table's overrides and return an empty object.
Local tables and custom table implementations without override support reject
this operation.
#### Returns
`Promise`&lt;`Record`&lt;`string`, `unknown`&gt;&gt;
***
### restore()
```ts
@@ -1501,6 +1807,44 @@ resolves to the new table version.
***
### updateTableOverrides()
```ts
updateTableOverrides(overrides): Promise<Record<string, unknown>>
```
Recursively merge overrides into a remote Enterprise table's stored overrides.
Fetches the current overrides, merges nested objects locally, then sends the
complete replacement using REST PUT. Other values replace existing values;
unrelated fields from the read snapshot are preserved. This read-modify-write
is not atomic: concurrent edits can be overwritten, even to unrelated fields.
Coordinate writers when concurrent edits must be preserved. An empty update
only reads and returns the current overrides.
Unlike this SDK method, CLI `set` and REST PUT replace the overrides object
without merging. Use [Table.resetTableOverrides](Table.md#resettableoverrides) to clear all overrides.
Local tables and custom table implementations without override support reject
this operation.
#### Parameters
* **overrides**: `Record`&lt;`string`, `unknown`&gt;
#### Returns
`Promise`&lt;`Record`&lt;`string`, `unknown`&gt;&gt;
#### Example
```ts
await table.updateTableOverrides({
job_types: { compaction: { enabled: false } },
});
```
***
### vectorSearch()
```ts
@@ -1561,3 +1905,26 @@ Waits for asynchronous indexing to complete on the table.
#### Returns
`Promise`&lt;`void`&gt;
***
### waitFresh()
```ts
abstract waitFresh(column, timeoutSeconds?): Promise<FunctionColumnStatus>
```
Poll until no stale or never-computed rows remain.
Only HTTP 503 with the exact finalization-pending error code is retried;
every other error propagates. Failed rows do not block completion.
#### Parameters
* **column**: `string`
* **timeoutSeconds?**: `number`
#### Returns
`Promise`&lt;[`FunctionColumnStatus`](../interfaces/FunctionColumnStatus.md)&gt;
+5
View File
@@ -686,6 +686,11 @@ searchEffort(searchEffort): VectorQuery
Set the initial IVF search effort to a finite value in [0, 1].
Efforts 0.1 and 0.25 target empirical mean partition-routing recall of
80% and 90% for L2, cosine and dot through k=100000. The probe budget
adapts to the metric and k. Hamming and larger k remain uncalibrated;
100000 is not an API limit. Remote queries also require server support.
The default, null, uses Auto (internally 0.5). Zero starts at the caller
minimum; one searches all partitions within the caller maximum. Later
probing may continue when too few candidates are found.
+20
View File
@@ -74,6 +74,8 @@
- [ClientConfig](interfaces/ClientConfig.md)
- [ColumnAlteration](interfaces/ColumnAlteration.md)
- [ColumnOrdering](interfaces/ColumnOrdering.md)
- [CompactionOptions](interfaces/CompactionOptions.md)
- [CompactionResult](interfaces/CompactionResult.md)
- [CompactionStats](interfaces/CompactionStats.md)
- [ConnectNamespaceOptions](interfaces/ConnectNamespaceOptions.md)
- [ConnectionOptions](interfaces/ConnectionOptions.md)
@@ -94,10 +96,18 @@
- [FtsToken](interfaces/FtsToken.md)
- [FullTextQuery](interfaces/FullTextQuery.md)
- [FullTextSearchOptions](interfaces/FullTextSearchOptions.md)
- [FunctionColumnAutoRefreshStatus](interfaces/FunctionColumnAutoRefreshStatus.md)
- [FunctionColumnLastRefreshJob](interfaces/FunctionColumnLastRefreshJob.md)
- [FunctionColumnStatus](interfaces/FunctionColumnStatus.md)
- [FunctionColumnVersionStatus](interfaces/FunctionColumnVersionStatus.md)
- [FunctionErrorFragment](interfaces/FunctionErrorFragment.md)
- [FunctionErrorRecord](interfaces/FunctionErrorRecord.md)
- [FunctionErrors](interfaces/FunctionErrors.md)
- [FunctionErrorsOptions](interfaces/FunctionErrorsOptions.md)
- [FunctionRefreshPlanningConfig](interfaces/FunctionRefreshPlanningConfig.md)
- [FunctionRefreshPodResources](interfaces/FunctionRefreshPodResources.md)
- [FunctionRetryPolicy](interfaces/FunctionRetryPolicy.md)
- [FunctionWorkerResourceBudget](interfaces/FunctionWorkerResourceBudget.md)
- [HnswPqOptions](interfaces/HnswPqOptions.md)
- [HnswSqOptions](interfaces/HnswSqOptions.md)
- [IndexConfig](interfaces/IndexConfig.md)
@@ -110,6 +120,7 @@
- [JobFailureInfo](interfaces/JobFailureInfo.md)
- [JobInfo](interfaces/JobInfo.md)
- [JobProgress](interfaces/JobProgress.md)
- [JobWaitOptions](interfaces/JobWaitOptions.md)
- [ListingOptions](interfaces/ListingOptions.md)
- [MaterializedViewDefinition](interfaces/MaterializedViewDefinition.md)
- [MemtableStats](interfaces/MemtableStats.md)
@@ -119,9 +130,15 @@
- [OpenTableOptions](interfaces/OpenTableOptions.md)
- [OptimizeOptions](interfaces/OptimizeOptions.md)
- [OptimizeStats](interfaces/OptimizeStats.md)
- [PrewarmDataOptions](interfaces/PrewarmDataOptions.md)
- [PrewarmDataPlan](interfaces/PrewarmDataPlan.md)
- [PrewarmDataResult](interfaces/PrewarmDataResult.md)
- [PrewarmPruningSummary](interfaces/PrewarmPruningSummary.md)
- [QueryExecutionOptions](interfaces/QueryExecutionOptions.md)
- [RTEStats](interfaces/RTEStats.md)
- [RTEWriteSpec](interfaces/RTEWriteSpec.md)
- [RTreeOptions](interfaces/RTreeOptions.md)
- [RefreshColumnOptions](interfaces/RefreshColumnOptions.md)
- [RefreshColumnResult](interfaces/RefreshColumnResult.md)
- [RefreshMaterializedViewResult](interfaces/RefreshMaterializedViewResult.md)
- [RemovalStats](interfaces/RemovalStats.md)
@@ -162,6 +179,7 @@
- [BlobMode](type-aliases/BlobMode.md)
- [BlobOptions](type-aliases/BlobOptions.md)
- [BlobRange](type-aliases/BlobRange.md)
- [BlobRangeRequest](type-aliases/BlobRangeRequest.md)
- [BlobReadOptions](type-aliases/BlobReadOptions.md)
- [BlobUri](type-aliases/BlobUri.md)
- [Data](type-aliases/Data.md)
@@ -174,6 +192,8 @@
- [JobProgressCallback](type-aliases/JobProgressCallback.md)
- [MaterializedViewSelect](type-aliases/MaterializedViewSelect.md)
- [MultiVector](type-aliases/MultiVector.md)
- [QueryParameterValue](type-aliases/QueryParameterValue.md)
- [QueryParameters](type-aliases/QueryParameters.md)
- [RecordBatchLike](type-aliases/RecordBatchLike.md)
- [SchemaLike](type-aliases/SchemaLike.md)
- [TableLike](type-aliases/TableLike.md)
+12
View File
@@ -71,3 +71,15 @@ await table.add(data, {
},
});
```
***
### retries?
```ts
optional retries: number;
```
Override the remote retry budget for this call (0 to 255). Zero disables
retries, including multipart parts. Ambiguous commits are never replayed.
Ignored by LanceDB Embedded.
@@ -0,0 +1,49 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / CompactionOptions
# Interface: CompactionOptions
Per-invocation compaction settings. Values must be safe integers.
## Properties
### batchSize?
```ts
optional batchSize: number;
```
Positive scanner batch size in rows.
***
### ioBufferSize?
```ts
optional ioBufferSize: number;
```
Scanner I/O read-ahead budget in bytes; zero disables byte-based I/O backpressure.
***
### maxSourceRows?
```ts
optional maxSourceRows: number;
```
Positive live-source-row budget across whole tasks; an oversized first task can produce no work.
***
### targetRowsPerFragment?
```ts
optional targetRowsPerFragment: number;
```
Positive target rows per output fragment; also affects candidate selection.
@@ -0,0 +1,99 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / CompactionResult
# Interface: CompactionResult
Actual committed outcome of one remote compaction job.
## Properties
### completionPercentage
```ts
completionPercentage: number;
```
Percentage of planned live rows committed, from 0 to 100.
***
### filesAdded
```ts
filesAdded: null | number;
```
Files added, including deletion files; null if an older worker omitted it.
***
### filesRemoved
```ts
filesRemoved: null | number;
```
Files removed, including deletion files; null if an older worker omitted it.
***
### fragmentsAdded
```ts
fragmentsAdded: null | number;
```
Fragments added by committed rewrites; null if an older worker omitted it.
***
### fragmentsRemoved
```ts
fragmentsRemoved: null | number;
```
Fragments removed by committed rewrites; null if an older worker omitted it.
***
### moreWork
```ts
moreWork: boolean;
```
A bounded run left eligible work for another invocation.
***
### partialCommit
```ts
partialCommit: boolean;
```
Some planned groups were not committed.
***
### rowsFailed
```ts
rowsFailed: number;
```
Planned live rows not committed by this job.
***
### rowsSucceeded
```ts
rowsSucceeded: number;
```
Live source rows in committed rewrite groups.
@@ -0,0 +1,98 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / FunctionColumnAutoRefreshStatus
# Interface: FunctionColumnAutoRefreshStatus
Automatic-refresh projection for a Function output.
## Properties
### activeJobId?
```ts
optional activeJobId: string;
```
***
### blockedReason?
```ts
optional blockedReason:
| "table_has_mem_wal"
| "inputs_not_settled"
| "dependency_in_flight"
| "table_capacity"
| "cancelled"
| "preparation_backoff"
| "failure_threshold_reached"
| "binding_revision_missing";
```
***
### effectiveCooldownMillis?
```ts
optional effectiveCooldownMillis: bigint;
```
***
### enabled
```ts
enabled: boolean;
```
***
### failureStreak
```ts
failureStreak: number;
```
***
### intervalSeconds?
```ts
optional intervalSeconds: bigint;
```
***
### nextRunAtMillis
```ts
nextRunAtMillis: null | bigint;
```
***
### nextRunAtReason?
```ts
optional nextRunAtReason: string;
```
***
### state
```ts
state:
| "running"
| "queued"
| "disabled"
| "ready"
| "up_to_date"
| "waiting_interval"
| "waiting_backoff"
| "blocked"
| "unobservable";
```
@@ -0,0 +1,51 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / FunctionColumnLastRefreshJob
# Interface: FunctionColumnLastRefreshJob
Latest matching refresh Job projected for a Function output.
## Properties
### automatic?
```ts
optional automatic: boolean;
```
***
### completedAtMillis?
```ts
optional completedAtMillis: bigint;
```
***
### failure?
```ts
optional failure: JobFailureInfo;
```
Structured failure details for a failed Job.
***
### jobId
```ts
jobId: string;
```
***
### state
```ts
state: string;
```
@@ -0,0 +1,108 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / FunctionColumnStatus
# Interface: FunctionColumnStatus
Exact four-way status of one Function output at one table version.
## Properties
### autoRefresh
```ts
autoRefresh: FunctionColumnAutoRefreshStatus;
```
***
### bindingId
```ts
bindingId: string;
```
***
### column
```ts
column: string;
```
***
### failed
```ts
failed: bigint;
```
***
### fresh
```ts
fresh: bigint;
```
***
### function
```ts
function: FunctionColumnVersionStatus;
```
***
### lastFailureJob?
```ts
optional lastFailureJob: FunctionColumnLastRefreshJob;
```
Newest failed refresh Job. This remains present when `lastRefreshJob`
is a later cancellation.
***
### lastRefreshJob?
```ts
optional lastRefreshJob: FunctionColumnLastRefreshJob;
```
***
### neverComputed
```ts
neverComputed: bigint;
```
***
### rows
```ts
rows: bigint;
```
***
### stale
```ts
stale: bigint;
```
***
### tableVersion
```ts
tableVersion: bigint;
```
@@ -0,0 +1,57 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / FunctionColumnVersionStatus
# Interface: FunctionColumnVersionStatus
Exact immutable Function revision attached to a table output.
## Properties
### location
```ts
location: string;
```
***
### manifestDigest
```ts
manifestDigest: string;
```
***
### name
```ts
name: string;
```
***
### namespacePath
```ts
namespacePath: string[];
```
***
### objectId
```ts
objectId: string;
```
***
### version
```ts
version: string;
```
@@ -90,3 +90,13 @@ detail was capped.
```ts
tableVersion: number;
```
***
### traceback?
```ts
optional traceback: string;
```
User-code traceback, possibly truncated by the server.
@@ -0,0 +1,50 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / FunctionRefreshPlanningConfig
# Interface: FunctionRefreshPlanningConfig
Resources and sizing policy for the planning fleet of one registered
Function refresh.
## Properties
### fragmentsPerWorker
```ts
fragmentsPerWorker: number;
```
Maximum fragments assigned to one planning worker.
***
### maxWorkers
```ts
maxWorkers: number;
```
Maximum number of planning workers.
***
### resources
```ts
resources: FunctionRefreshPodResources;
```
CPU, memory, and ephemeral-storage limits for one planning worker.
***
### rowsPerWorker
```ts
rowsPerWorker: number;
```
Maximum rows assigned to one planning worker.
@@ -0,0 +1,40 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / FunctionRefreshPodResources
# Interface: FunctionRefreshPodResources
CPU, memory, and ephemeral-storage limits for one Function refresh
control-plane pod.
## Properties
### cpuMillis
```ts
cpuMillis: number;
```
CPU limit in millicores; 1000 is one CPU.
***
### ephemeralStorageBytes
```ts
ephemeralStorageBytes: number;
```
Ephemeral storage limit in bytes.
***
### memoryBytes
```ts
memoryBytes: number;
```
Memory limit in bytes.
@@ -0,0 +1,91 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / FunctionRetryPolicy
# Interface: FunctionRetryPolicy
Overrides retries of failed user-code calls for one refresh. Omitted
fields use the Function refresh defaults.
## Properties
### errorCodes?
```ts
optional errorCodes: string[];
```
Structured provider error codes or HTTP status codes.
***
### exceptionTypes?
```ts
optional exceptionTypes: string[];
```
Exception class names, preferably qualified.
***
### honorRetryAfter?
```ts
optional honorRetryAfter: boolean;
```
Honor Retry-After within the configured maximum.
***
### initialBackoffSeconds?
```ts
optional initialBackoffSeconds: number;
```
Initial exponential-backoff ceiling, in seconds.
***
### maxAttempts?
```ts
optional maxAttempts: number;
```
Total calls, including the first; 1 disables retries, maximum 100.
***
### maxBackoffSeconds?
```ts
optional maxBackoffSeconds: number;
```
Maximum backoff, in seconds.
***
### messagePattern?
```ts
optional messagePattern: string;
```
Regular expression matched against the exception class and message.
***
### transient?
```ts
optional transient: boolean;
```
Match connection/timeouts, HTTP 429/503, SlowDown and
ServiceUnavailable.
@@ -0,0 +1,39 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / FunctionWorkerResourceBudget
# Interface: FunctionWorkerResourceBudget
Aggregate worker resources for one Enterprise Function refresh.
## Properties
### cpuMillis
```ts
cpuMillis: number;
```
Aggregate CPU budget in millicores; 1000 is one CPU.
***
### gpuCount?
```ts
optional gpuCount: number;
```
Aggregate GPU budget. Omitted means zero, a CPU-only refresh.
***
### memoryBytes
```ts
memoryBytes: number;
```
Aggregate memory budget in bytes.
+20
View File
@@ -31,3 +31,23 @@ optional phase: string;
```ts
optional retryable: boolean;
```
***
### sqlJobId?
```ts
optional sqlJobId: string;
```
Isolated SQL job that raised this failure, when supplied by the server.
***
### traceback?
```ts
optional traceback: string;
```
User-code traceback, possibly truncated by the server.
+98
View File
@@ -17,6 +17,14 @@ different counters. A missing counter is unknown; it is not zero.
## Properties
### bytes\_read?
```ts
optional bytes_read: null | number;
```
***
### estimated\_remaining\_time\_millis?
```ts
@@ -37,6 +45,72 @@ Execution identity and sample time used for client-side ETA derivation.
***
### executors\_active?
```ts
optional executors_active: null | number;
```
***
### executors\_completed?
```ts
optional executors_completed: null | number;
```
***
### executors\_failed?
```ts
optional executors_failed: null | number;
```
***
### executors\_partial?
```ts
optional executors_partial: null | number;
```
***
### executors\_targeted?
```ts
optional executors_targeted: null | number;
```
***
### fragments\_selected?
```ts
optional fragments_selected: null | number;
```
***
### groups\_completed?
```ts
optional groups_completed: null | number;
```
***
### groups\_planned?
```ts
optional groups_planned: null | number;
```
Maintenance work observations; rewritten rows are not committed rows.
***
### paused?
```ts
@@ -57,6 +131,22 @@ Coarse server-derived phase, including phases from newer servers.
***
### ranges\_completed?
```ts
optional ranges_completed: null | number;
```
***
### ranges\_planned?
```ts
optional ranges_planned: null | number;
```
***
### rows\_computed?
```ts
@@ -92,6 +182,14 @@ optional rows_remaining: null | number;
***
### rows\_rewritten?
```ts
optional rows_rewritten: null | number;
```
***
### rows\_skipped?
```ts
+31
View File
@@ -0,0 +1,31 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / JobWaitOptions
# Interface: JobWaitOptions
Client-side controls for waiting without cancelling the underlying job.
## Properties
### onProgress?
```ts
optional onProgress: JobProgressCallback;
```
Observe progress using the same poller that waits for completion.
***
### timeoutMs?
```ts
optional timeoutMs: number;
```
Maximum wait in milliseconds, including status requests and polling backoff.
Must be a nonnegative safe integer. Omit to wait indefinitely; zero allows
only an immediately ready result.
+22
View File
@@ -33,6 +33,28 @@ tbl.optimize({cleanupOlderThan: new Date()});
***
### compactionOptions?
```ts
optional compactionOptions: CompactionOptions;
```
Compaction settings for this invocation. Omitted remote values inherit table
tuning, then deployment/built-in defaults.
Remote tables require a server supporting these SQL options; settings do
not change table policy. This is not a runtime or total-memory limit.
#### Example
```ts
await tbl.optimize({ compactionOptions: {
targetRowsPerFragment: 1000, maxSourceRows: 5000,
ioBufferSize: 64 * 1024 * 1024, batchSize: 128,
} });
```
***
### deleteUnverified
```ts
@@ -0,0 +1,49 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / PrewarmDataOptions
# Interface: PrewarmDataOptions
Settings for data-cache prewarm submissions and metadata previews.
## Properties
### columns?
```ts
optional columns: string[];
```
Lance field paths to warm; omitted or empty means every column.
***
### concurrency?
```ts
optional concurrency: number;
```
Positive per-executor concurrency, at most 4294967295.
***
### filter?
```ts
optional filter: string;
```
A single SQL predicate for conservative metadata pruning.
***
### parameters?
```ts
optional parameters: QueryParameters;
```
Typed positional or named filter values, sent separately from SQL.
+37
View File
@@ -0,0 +1,37 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / PrewarmDataPlan
# Interface: PrewarmDataPlan
Metadata-only snapshot preview; no warming job is submitted.
## Properties
### plan
```ts
plan: string;
```
Readable display text. Use pruning for structured facts.
***
### pruning
```ts
pruning: PrewarmPruningSummary;
```
***
### tableVersion
```ts
tableVersion: number;
```
Snapshot used for this preview. A later submission plans its own snapshot.
@@ -0,0 +1,79 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / PrewarmDataResult
# Interface: PrewarmDataResult
Reported executor work for a pinned snapshot; unavailable measurements stay null.
## Properties
### bytesRead
```ts
bytesRead: null | number;
```
Reported bytes read, or null when unavailable.
***
### executorsCompleted
```ts
executorsCompleted: null | number;
```
Executors that finished successfully or partially, or null when unavailable.
***
### executorsPartial
```ts
executorsPartial: null | number;
```
Subset of completed executors reporting partial warming, or null when unavailable.
***
### executorsTargeted
```ts
executorsTargeted: null | number;
```
Reported executors targeted, or null when unavailable.
***
### fragmentsSelected
```ts
fragmentsSelected: null | number;
```
Reported fragments selected, or null when unavailable.
***
### rangesCompleted
```ts
rangesCompleted: null | number;
```
Reported ranges completed, or null when unavailable.
***
### tableVersion
```ts
tableVersion: number;
```
The source snapshot captured by submission.
@@ -0,0 +1,61 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / PrewarmPruningSummary
# Interface: PrewarmPruningSummary
Conservative metadata proof, rather than exact matching rows.
## Properties
### fallbackReason
```ts
fallbackReason: null | string;
```
***
### inputFragments
```ts
inputFragments: number;
```
***
### mode
```ts
mode: string;
```
Server-reported proof mode; future servers may add modes.
***
### prunedFragments
```ts
prunedFragments: number;
```
***
### selectedFragments
```ts
selectedFragments: number;
```
***
### selectedRowRanges
```ts
selectedRowRanges: null | number;
```
Candidate physical intervals, or null when unknown.
@@ -29,8 +29,10 @@ Selecting a parent struct or directly aliasing a blob or struct also returns
bytes. Blobs inside lists keep their descriptors. Arbitrary projection
expressions are not materialized as bytes.
The rows and the bytes come from the same table version. If the table
changes while the query runs, the query runs again, up to three times.
The rows and bytes come from the same snapshot. Remote queries require
authoritative query version and snapshot identity headers, verified again
by the blob response. Older servers can still return `"descriptions"`.
Local queries retry up to three times if the table changes while they run.
#### Example
@@ -64,3 +66,6 @@ optional timeoutMs: number;
```
Timeout for query execution in milliseconds
The timeout also covers reading the results, so consuming them slowly can
exceed it.
+21
View File
@@ -0,0 +1,21 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / RTreeOptions
# Interface: RTreeOptions
Options to create an `RTREE` index
## Properties
### pageSize?
```ts
optional pageSize: number;
```
The maximum number of entries in each R-tree page.
Must be at least 2. The default is 4096.
@@ -0,0 +1,190 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / RefreshColumnOptions
# Interface: RefreshColumnOptions
Options for `Table.refreshColumn` and `Table.refreshColumnAsync`. Every
option is LanceDB Enterprise only; a LanceDB Embedded refresh ignores
`batchSize`, `gpuClass` and `gpuCount` and rejects the rest, including
`resourceBudget`.
## Properties
### batchSize?
```ts
optional batchSize: number;
```
Maximum rows per Function call; must be greater than zero.
***
### errorPolicy?
```ts
optional errorPolicy: string;
```
`"fail"` (default) stops on a row error; `"skip"` writes null and
records the error, subject to the failure limits.
***
### gpuClass?
```ts
optional gpuClass: string;
```
GPU class for Function workers.
***
### gpuCount?
```ts
optional gpuCount: number;
```
Positive aggregate GPU budget for Function workers.
***
### initTimeoutSeconds?
```ts
optional initTimeoutSeconds: number;
```
Deadline for Function initialization, in seconds.
***
### maxConcurrency?
```ts
optional maxConcurrency: number;
```
Override the registered Function's maximum concurrent user-code calls
for this logical execution.
***
### maxExecutorProcessesPerWorker?
```ts
optional maxExecutorProcessesPerWorker: number;
```
Cap on executor processes per Function worker.
***
### maxFailedFraction?
```ts
optional maxFailedFraction: number;
```
Under a skip policy, fail the job once more than this share of rows
(0 to 1) has failed.
***
### maxFailedRows?
```ts
optional maxFailedRows: number;
```
Under a skip policy, fail the job once more than this many rows have
failed.
***
### numWorkers?
```ts
optional numWorkers: number;
```
Worker count for an expression column; Function columns reject it.
***
### planningWorkers?
```ts
optional planningWorkers: FunctionRefreshPlanningConfig;
```
Resources and sizing for the refresh planning fleet.
***
### publicationIntervalRows?
```ts
optional publicationIntervalRows: number;
```
Row-count threshold for publishing completed Function split ranges.
Must be a positive safe integer. Omit for whole-fragment publication.
Actual publications can be larger; remaining rows publish at completion.
Requires LanceDB Enterprise with non-Blob Function outputs.
***
### resourceBudget?
```ts
optional resourceBudget: FunctionWorkerResourceBudget;
```
Complete aggregate CPU and memory budget for a registered Function
refresh. `gpuCount` inside the budget defaults to zero.
***
### retryPolicy?
```ts
optional retryPolicy: FunctionRetryPolicy;
```
Override retries of failed user-code calls for this refresh.
***
### rowTimeoutSeconds?
```ts
optional rowTimeoutSeconds: number;
```
Deadline for one Function call, in seconds.
***
### supervisorResources?
```ts
optional supervisorResources: FunctionRefreshPodResources;
```
CPU, memory, and ephemeral-storage limits for the refresh supervisor.
***
### where?
```ts
optional where: string;
```
Only refresh the rows matching this SQL filter.
@@ -8,6 +8,26 @@
## Properties
### retries?
```ts
optional retries: number;
```
Override the remote retry budget for this execution only (an integer from
0 to 255). Use `execute(data, { retries: 0 })` to disable even retries after
precommit conflicts (409) or rate limits (429). This does not change
connection-wide/read budgets or local transaction conflict retries.
By default, remote calls use the connection's `clientConfig.retryConfig`
([RetryConfig](RetryConfig.md)). Its `statuses` (also set through
`LANCE_CLIENT_RETRY_STATUSES`) selects candidates within the retry budget;
it never permits replay of ambiguous merge outcomes. In particular, 502,
ordinary 503, and 504 are never replayed, even if configured. Reconcile table
contents before manually repeating a merge whose commit outcome is unknown.
***
### timeoutMs?
```ts
@@ -24,3 +44,6 @@ the second attempt will be cancelled after 10 seconds, hitting the
first attempt will not be cancelled.
When this is set, the timeout is enforced on all attempts, including the first.
For remote tables this is sent as a server execution timeout. It does not
extend HTTP read or proxy idle timeouts, or prove that a failed request did
not commit.
@@ -0,0 +1,39 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / BlobRangeRequest
# Type Alias: BlobRangeRequest
```ts
type BlobRangeRequest: object;
```
One row-specific range for [Table.fetchBlobRanges](../classes/Table.md#fetchblobranges).
## Type declaration
### length
```ts
length: bigint;
```
Number of bytes to read, as a uint64. Zero returns an empty non-null value.
### offset
```ts
offset: bigint;
```
Byte offset from the beginning of the logical blob, as a uint64.
### rowId
```ts
rowId: bigint | number;
```
A row ID from a query with row IDs enabled.
@@ -0,0 +1,20 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / QueryParameterValue
# Type Alias: QueryParameterValue
```ts
type QueryParameterValue:
| string
| number
| bigint
| boolean
| Date
| Uint8Array
| null;
```
Scalar SQL values. Use a one-row Arrow table for explicit Arrow types.
@@ -0,0 +1,16 @@
[**@lancedb/lancedb**](../README.md) • **Docs**
***
[@lancedb/lancedb](../globals.md) / QueryParameters
# Type Alias: QueryParameters
```ts
type QueryParameters: readonly QueryParameterValue[] | Readonly<Record<string, QueryParameterValue>> | TableLike | RecordBatchLike;
```
Values for `$1`/`$name` placeholders, sent separately from SQL text.
Arrays bind by position; objects bind by name. Arrow columns bind both ways.
Safe integers and bigint use Int64; fractional numbers use Float64.
Arrow input preserves explicit types.
+323 -16
View File
@@ -37,11 +37,43 @@ embedding_functions`. Prefer keyword arguments for optional parameters.
::: lancedb.db.DBConnection
Embedded connections support `location=` on `open_table` to open a table from an
explicit dataset URI instead of the derived `<database>/<name>.lance` path:
```python
db = lancedb.connect("./data")
table = db.open_table("events", location="./datasets/events.lance")
```
Use `db.server_info()` (or `await db.server_info()` on an asynchronous connection)
to include the responding server's release, Git revision, build date and Function
runtime information in a bug report. It returns a JSON-compatible dictionary and
does not submit a query or job. Configured images are distinct from the version
of an already running job. During a rolling upgrade, successive requests can
reach different query-node builds. Embedded connections and older servers without
the endpoint raise `NotImplementedError`.
::: lancedb.server_info.ServerBuildInfo
::: lancedb.server_info.ServerInfo
Resource listings return iterators. Use `list(db.list_tables())` to collect all
table names. `db.list_tables().tables` is a list of the first page; `limit`
controls its page size and `page_token` resumes at a saved token. The same
patterns apply to `list_namespaces()`. Other resource listings use `page_limit`.
For existence checks, use `db.table_exists(["events"])` or `"events" in db`.
These look up the table directly and work even when the database has more than
100 tables. For a table in a namespace, include the namespace segments:
```python
exists = db.table_exists(["analytics", "events"])
```
When migrating from `name in db.table_names()`, use `name in db` or
`db.table_exists([name])`. Checking `name in db.list_tables().tables` only
searches the first page and can miss an existing table.
Resource listings (`list_storage_integrations`, `list_secrets`, `list_views`, `list_jobs`, `list_functions`, and
`list_materialized_views`) return lazy iterators. Use `list(db.list_views())` to
collect synchronous results, or `[name async for name in db.list_views()]` with
@@ -352,9 +384,27 @@ accept the LanceDB Embedded options: cleanup and compaction warn that they are n
`optimize` submits a durable compaction job and returns once that submission is
accepted, not once compaction itself finishes. Pruning and index optimization
are not yet supported remotely, so it silently skips them and returns with
zeroed pruning statistics rather than attempting and failing. A non-default
`compaction_options` raises `NotImplementedError` before anything is
submitted, since there is no way yet to forward those settings to the server.
zeroed pruning statistics. Remote `compaction_options` support per-job
`target_rows_per_fragment`, `max_source_rows`, `io_buffer_size`, and `batch_size`
on compatible servers. Other non-default settings raise `NotImplementedError`
before submission; older-server errors are returned without dropping options.
The source-row budget selects whole tasks and can produce no work if the first
task exceeds it. An I/O buffer size of zero disables byte-based I/O backpressure.
Use a positive size to limit I/O read-ahead; this is not a total-memory limit.
Each field resolves as invocation option → table tuning → deployment/built-in
default. These options apply only to the submitted job and leave table policy
unchanged. Table `enabled` controls automatic scheduling; explicit manual runs
remain allowed.
```python
table.optimize(compaction_options={
"target_rows_per_fragment": 100_000,
"max_source_rows": 1_000_000,
"io_buffer_size": 64 * 1024 * 1024,
"batch_size": 1024,
})
```
Removed Tantivy options produce the same explanatory errors on both backends.
The old LanceDB Enterprise keyword names `predicate` for `delete`, `index_name` for
@@ -382,24 +432,45 @@ code that used the former LanceDB Enterprise-only argument order.
## Functions and Jobs
A decorated `udf` definition is also a local callable. Call a decorated function
Use `progress=True` when waiting for Function registration in a notebook or
terminal. A callback receives structured snapshots instead:
```python
fn = db.create_function(my_function, progress=True)
registration = db.create_function_async(other_function)
fn = registration.wait(progress=lambda snapshot: print(snapshot))
print(fn.image.describe())
```
Registration uses the existing SQL query handle. The current handle reports
lifecycle state and `client_elapsed_time_millis` since the handle was created;
detailed build phases and build logs are unavailable. Keep the same handle after
a wait timeout to resume waiting. Failures retain the server error and request
identifiers. `fn.image` has a concise representation; `describe()` exposes Python
and CUDA requirements without inspecting Pydantic internals. Platforms, base image
and size are `None` until the service reports them. The full image descriptor and
canonical JSON remain available.
A `@function` definition is also a local callable. Call a decorated function
directly with row inputs, or call a decorated class with its initialization fields
and then call the returned instance; call `close()` if the class defines it. This
path uses the current Python environment and does not create a registered
`FunctionVersion`, build the declared remote runtime, resolve Secrets, or execute
the remote Arrow adapter. A registered `FunctionVersion` call instead binds
`col(...)` inputs and returns a remote `FunctionApplication`.
`col(...)` inputs and returns a remote `FunctionApplication`. Passing an `Expr`
such as `col("value")` to a definition raises `TypeError` before the callable
runs; bind it on the registered `FunctionVersion` instead.
```python
from lancedb import udf
from lancedb import function
@udf
@function
def normalize(text: str) -> str:
return text.strip().lower()
@udf
@function
class Scale:
def __init__(self, factor: float):
self.factor = factor
@@ -417,6 +488,98 @@ assert scaler(3.0) == 6.0
scaler.close()
```
### Function packaging restrictions
The decorator snapshots the Function's source and referenced globals into a new
module. It supports three statically recognizable diagnostic operations:
`sys.stderr`, `sys.version_info`, and `importlib.metadata.version`. Direct
imports, `from` imports, and aliases are treated the same way, whether the
import appears inside a function or class body or at module level.
Other imports of `sys`, `builtins`, `importlib`, `inspect`, `gc`, `ctypes`, and
`types`, including submodules such as `ctypes.util` and `importlib.resources`,
remain blocked. This applies to imports inside function or class bodies and
references to module-level aliases. Even ordinary uses such as `sys.version`
and `ctypes.util.find_library` are blocked: these modules can reach names
outside the reconstructed Function namespace. References to `globals`, `locals`,
`vars`, `eval`, `exec`, `compile`, and `__import__` are rejected as dynamic
namespace access. These restrictions also apply to the deprecated `@udf` alias.
For example, a diagnostic Function can report its Python version and NumPy
version without a helper module:
```python
import importlib.metadata
import sys
from lancedb import function
@function(pip=["numpy"])
def report(value: int) -> str:
print("diagnostic", file=sys.stderr)
return f"numpy {importlib.metadata.version('numpy')} on {sys.version_info}"
```
For other restricted uses, move the code into an importable helper module and
ship it with `code=`, or install its package with `pip=` or `conda=`. Imported
helpers keep their own namespace; the packager does not scan their bodies.
Helpers defined in `__main__` are copied by source and have the same
restrictions as the Function.
For example, put this helper in `native_diagnostics/__init__.py`:
```python
import ctypes.util
def find_library(name: str) -> str:
return ctypes.util.find_library(name) or ""
```
Then import the helper and include its source in the Function's artifact:
```python
import native_diagnostics
from lancedb import function
@function(code=[native_diagnostics])
def probe_library(name: str) -> str:
return native_diagnostics.find_library(name)
```
Captured globals are copied into the Function's source. They can be `None`,
booleans, integers, strings, bytes, and finite floats; tuples, lists, dicts,
sets, and frozensets of supported values; PyArrow data types, fields, and
schemas; and NumPy arrays and scalars of bool, integer, `float16`, `float32`,
and `float64` dtypes. The copy is taken when the decorator runs and rebuilt in
each worker process, so later changes on either side are not shared. NumPy
values need `numpy` in the remote environment; declare it with `pip=` or
`conda=`. Each value is limited to 1 MiB of source and 32 levels of nesting;
load larger data inside the Function, for example from a table or a package
resource shipped with `code=`. Construct other objects inside the Function or
helper module instead. Values used only in the decorator's `input_schema` or
`output_schema` are not captured globals and can be defined outside the
Function.
```python
import pyarrow as pa
from lancedb import function
LABELS = {"pick": 0, "place": 1}
RESULT = pa.struct([pa.field("label", pa.string()), pa.field("id", pa.int32())])
@function(
input_schema=pa.schema([pa.field("action", pa.string(), nullable=False)]),
output_schema=pa.field("result", RESULT, nullable=False),
)
def label(action: pa.Array) -> pa.Array:
rows = [{"label": name, "id": LABELS[name]} for name in action.to_pylist()]
return pa.array(rows, type=RESULT)
```
Annotate a blob input with `lancedb.BlobReader` for lazy, seekable access, or
with `bytes` to materialize its contents before the Function runs. Reader
inputs infer the Blob V2 type without an explicit input schema. Readers are
@@ -455,9 +618,9 @@ with BlobReader(read_range, len(payload)) as reader:
::: lancedb.functions.PythonEnvironmentSpec
::: lancedb.functions.udf
::: lancedb.functions.function
::: lancedb.functions.UdfDefinition
::: lancedb.functions.FunctionDefinition
::: lancedb.secrets.EnvVarSecret
@@ -465,6 +628,8 @@ with BlobReader(read_range, len(payload)) as reader:
::: lancedb.functions.FunctionRegistrationRequest
::: lancedb.functions.FunctionRetryPolicy
::: lancedb.functions.FunctionArtifactRequest
::: lancedb.functions.FunctionArtifactContent
@@ -475,6 +640,14 @@ with BlobReader(read_range, len(payload)) as reader:
::: lancedb.functions.FunctionVersion
::: lancedb.functions.FunctionEnvironment
::: lancedb.functions.ResolvedEnvironment
::: lancedb.functions.ResolvedPackage
::: lancedb.functions.ResolvedEnvironmentProvenance
::: lancedb.functions.HuggingFaceModel
::: lancedb.functions.PythonRuntimeSpec
@@ -489,6 +662,8 @@ with BlobReader(read_range, len(payload)) as reader:
::: lancedb.functions.InputBinding
::: lancedb.functions.LiteralInputBinding
::: lancedb.functions.OutputMapping
::: lancedb.functions.AssignmentMapping
@@ -497,12 +672,28 @@ with BlobReader(read_range, len(payload)) as reader:
::: lancedb.functions.RefreshColumnResult
::: lancedb.FunctionErrors
::: lancedb.functions.FunctionErrorGroup
::: lancedb.functions.FunctionProvenance
::: lancedb.functions.FunctionValueProvenance
::: lancedb.functions.AsyncFunctionErrors
::: lancedb.functions.FunctionErrors
::: lancedb.FunctionErrorRecord
::: lancedb.FunctionErrorFragment
::: lancedb.FunctionColumnStatus
::: lancedb.FunctionColumnVersionStatus
::: lancedb.FunctionColumnLastRefreshJob
::: lancedb.FunctionColumnAutoRefreshStatus
::: lancedb.job.Job
::: lancedb.job.AsyncJob
@@ -530,6 +721,20 @@ remain available, as do LanceDB Enterprise operations. The same feature
requirement applies to LanceDB Embedded SQL computed-column declaration and refresh; ordinary
eager `add_columns` transforms remain available.
Pass a complete defining SQL query with `query=` to use grouping, Functions
in `FROM`, or `UNNEST`:
```python
view = db.create_materialized_view(
"events_by_kind",
query="SELECT kind, count(*) AS n FROM events GROUP BY kind",
)
```
`query` is mutually exclusive with `source`, `select`, `where`, and `limit`.
It is also accepted by asynchronous connections and `create_materialized_view_async`.
The backend SQL parser determines which query shapes are supported.
In LanceDB Enterprise, creation accepts `auto_refresh_enabled` and
`auto_refresh_interval_seconds`:
@@ -598,6 +803,8 @@ of raw SQL strings with [where][lancedb.query.LanceQueryBuilder.where] and
::: lancedb.query.Query
::: lancedb.query.ColumnOrdering
::: lancedb.query.LanceQueryBuilder
::: lancedb.query.LanceVectorQueryBuilder
@@ -708,6 +915,27 @@ with `search().with_row_id(True).to_arrow()` and pass the result to the fetch AP
One missing or deleted row ID rejects the entire blob-read batch; the APIs do
not return partial results.
Row positions are not row IDs. To read by position, call
`take_offsets(offsets, with_row_id=True)` first and pass the resulting `_rowid`
values; `fetch_blobs` remains row-ID based. A query result table that carries
snapshot metadata keeps the snapshot that produced it on LanceDB Enterprise, so
the fetched bytes or files stay pinned if the table changes. Metadata-free
inputs, including legacy query responses and plain row-ID lists, are read from
the table handle's current snapshot; keep the source unchanged between selection
and fetching. Partial snapshot metadata fails explicitly. For `fetch_blob_files`,
a snapshot-bound read also fails explicitly when the serving node cannot echo
the immutable identity. The basic remote Blob API floor (server 0.5.0) does not
by itself provide that echo capability.
Local and remote `BlobFile` handles prefetch 512 KiB for sequential reads by
default. Pass `buffer_size=0` to `fetch_blob_files`, `open_blob_file`, or
`open_blob_files` for sparse reads, or choose another window size in bytes.
Call `file.set_buffer_size(size)` to change it without moving the cursor;
changing the size discards unused prefetched bytes. Explicit `read_range` and
`read_ranges` calls always read exactly the requested intervals and leave the
cursor unchanged. Remote prefetch consumes the HTTP response completely before
returning, so idle handles do not hold request concurrency slots or connections.
To construct inline Blob V2 arrays for ingestion in record batches, use
[blob_array][lancedb.schema.blob_array]. It accepts bytes and `None`, preserving
the distinction between an empty blob (`b""`) and a null blob:
@@ -732,9 +960,42 @@ PyArrow's `RecordBatch.from_pylist(..., schema=...)` cannot convert raw bytes
into the blob extension type; use `blob_array` and `RecordBatch.from_arrays`
when constructing batches explicitly.
For external blob references, construct the descriptor struct described by
[blob][lancedb.schema.blob], then wrap it with `pa.ExtensionArray.from_storage`.
Inline `data` and external `uri` representations are mutually exclusive.
For external blob references, use [blob_uri_array][lancedb.blob_uri_array]. It builds the
same extension type from URI strings and optional `(position, size)` byte
ranges without requiring pylance. Inline `data` and external `uri` representations
are mutually exclusive.
Register the object prefix with [BasePath][lancedb.BasePath] on
`create_table(..., initial_bases=[...])` to store a matched absolute blob URI
relative to a base and to scope credentials with `base_<id>.<option>` storage
options. A create with data stays a single atomic request; without a matching
base, pass `allow_external_blob_outside_bases=True` to keep the absolute URI
instead. That opt-in still expects a valid absolute URI and applies to one
write; a later `add()` needs its own opt-in. When registering several bases,
supply distinct explicit non-zero IDs: the pinned Lance release can collide
when automatic and explicit IDs are mixed, leaving a listed but unopenable name
after a failed create; retrying with distinct explicit IDs succeeds.
```python
from lancedb import BasePath, blob, blob_uri_array
schema = pa.schema(
[
pa.field("id", pa.int64()),
blob("video").with_metadata({"lancedb:logical_type": "mp4"}),
]
)
videos = blob_uri_array(
["s3://bucket/clip-0.mp4", "s3://bucket/clip-1.mp4"],
positions=[0, 0],
sizes=[1 << 20, 1 << 20],
)
db.create_table(
"videos",
data=pa.RecordBatch.from_arrays([pa.array([0, 1]), videos], schema=schema),
initial_bases=[BasePath("s3://bucket")],
)
```
LanceDB Enterprise SQL returns blob bytes by default. Select `blob_descriptor(video)` to
return an openable reference instead, then use
@@ -796,6 +1057,10 @@ so the fetch APIs cannot read their bytes yet.
::: lancedb.schema.blob_array
::: lancedb.blob_uri_array
::: lancedb.BasePath
::: lancedb._blob.BlobFile
options:
show_root_full_path: false
@@ -811,8 +1076,8 @@ so the fetch APIs cannot read their bytes yet.
## Exceptions
Remote HTTP responses with structured resource details raise a subclass of
`HttpError`. Older servers that omit those details raise plain `HttpError`, so
`except HttpError` remains a compatible catch-all:
`HttpError`. Older servers that omit those details generally raise plain
`HttpError`, so `except HttpError` remains a compatible catch-all:
```python
from lancedb.remote.errors import (
@@ -833,6 +1098,19 @@ except HttpError as error:
print("request failed:", error.request_id, error.status_code)
```
Remote branch deletion sends a single request. If the server rejects it with
HTTP 409, it raises `ConflictError` with the server's reason, including when an
older server omits structured resource details. A structured `already_exists`
response keeps its more specific `AlreadyExistsError` type. Both are subclasses
of `HttpError`.
A remote query whose streamed response stops partway raises
`ResponseInterruptedError`, also a subclass of `HttpError`. It carries the number
of batches and rows already returned and, when the server reports it, the table
version the response reflected, so the query can be run again against that
version. It is never retried automatically, because the batches already returned
would be returned again.
SQL response failures raise `SqlError`, retaining the numeric `grpc_code` and
`request_id`. Servers that report a recognized `x-lancedb-error-code` select a
specific input-error subclass. HTTP failures use the corresponding `HttpError`
@@ -898,6 +1176,10 @@ generic HTTP/SQL exceptions with their transport status and current request ID.
::: lancedb.remote.errors.AlreadyExistsError
::: lancedb.remote.errors.ConflictError
::: lancedb.remote.errors.ResponseInterruptedError
::: lancedb.exceptions.MissingValueError
::: lancedb.exceptions.MissingColumnError
@@ -1010,6 +1292,11 @@ the page list does not consume the iterator. `page.page_token` is the token for
the next request; drain cached results before using it to resume in a new
listing. The same behavior applies to namespaces.
Use `await db.table_exists(["events"])` to check for a table in the root
namespace, or `await db.table_exists(["analytics", "events"])` for a table in
a namespace. Checking membership in an awaited listing's `.tables` attribute
only searches one page.
::: lancedb.listing.AsyncTableListing
::: lancedb.listing.AsyncNamespaceListing
@@ -1278,3 +1565,23 @@ name; omitting it allows matching reads of any revision. Prefixes must be concre
paths without wildcards or traversal. This integration does not make Hugging Face
a writable database location for `ATTACH DATABASE`. Dataset SQL sources select a
matching integration automatically, with no integration argument in the query.
### Function package resources
`@function(code=[my_package])` includes the package’s Python modules and data
files, including vendored subpackages. Resource paths and bytes are preserved,
so `importlib.resources` and package integrity checks work after deployment.
Changing a resource changes the Function artifact digest. This requires a server
that accepts `python_bundle.resources`.
Caches, hidden paths, symlinks and unsafe paths are excluded. Use `pip=` or
`conda=` for platform-specific dependencies and `models=` for large model snapshots.
::: lancedb.compaction.CompactionResult
::: lancedb.prewarm.PrewarmDataResult
::: lancedb.prewarm.PrewarmDataPlan
::: lancedb.prewarm.PrewarmPruningSummary
+1 -1
View File
@@ -3,6 +3,6 @@
lancedb==0.41.0b10
numpy==2.2.6
pandas==2.3.3
pillow==12.1.1
pillow==13.0.0
pytest==8.4.2
pytest-asyncio==1.2.0
@@ -0,0 +1,149 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright The LanceDB Authors
def test_photo_tutorial(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
# --8<-- [start:photo_files]
import struct
import zlib
from pathlib import Path
def solid_png(rgb):
def chunk(kind, data):
checksum = zlib.crc32(kind + data) & 0xFFFFFFFF
return (
struct.pack(">I", len(data)) + kind + data + struct.pack(">I", checksum)
)
header = struct.pack(">IIBBBBB", 8, 8, 8, 2, 0, 0, 0)
pixels = (b"\x00" + bytes(rgb) * 8) * 8
return (
b"\x89PNG\r\n\x1a\n"
+ chunk(b"IHDR", header)
+ chunk(b"IDAT", zlib.compress(pixels))
+ chunk(b"IEND", b"")
)
inputs = Path("photo-inputs")
inputs.mkdir()
for label, rgb in [("red", (255, 0, 0)), ("blue", (0, 0, 255))]:
(inputs / f"{label}.png").write_bytes(solid_png(rgb))
# --8<-- [end:photo_files]
# --8<-- [start:photo_connect_embedded]
import lancedb
db = lancedb.connect("./photo-db")
# --8<-- [end:photo_connect_embedded]
# --8<-- [start:photo_ingest]
import pyarrow as pa
schema = pa.schema(
[
pa.field("id", pa.int64(), nullable=False),
pa.field("label", pa.string(), nullable=False),
lancedb.blob("image", nullable=False),
],
metadata={"lance.blob.managed": "false"},
)
photos = db.create_table("photos", schema=schema)
photos.add(
[
{"id": 1, "label": "red", "image": (inputs / "red.png").read_bytes()},
{"id": 2, "label": "blue", "image": (inputs / "blue.png").read_bytes()},
]
)
assert photos.count_rows() == 2
# --8<-- [end:photo_ingest]
# --8<-- [start:photo_fetch]
hits = (
photos.search()
.where("label = 'red'")
.select(["id", "label"])
.with_row_id(True)
.limit(10)
.to_list()
)
assert [row["id"] for row in hits] == [1]
payloads = photos.fetch_blobs("image", [row["_rowid"] for row in hits]).to_pylist()
assert payloads == [(inputs / "red.png").read_bytes()]
saved = Path("selected-red.png")
saved.write_bytes(payloads[0])
assert saved.read_bytes() == (inputs / "red.png").read_bytes()
# --8<-- [end:photo_fetch]
# --8<-- [start:photo_bytes]
rows = (
photos.search()
.where("label = 'red'")
.select(["id", "image"])
.limit(10)
.to_list(blob_mode="bytes")
)
assert rows == [{"id": 1, "image": (inputs / "red.png").read_bytes()}]
# --8<-- [end:photo_bytes]
# --8<-- [start:photo_ranges]
with photos.fetch_blob_files("image", [hits[0]["_rowid"]])[0] as reader:
assert reader.read_range(0, 8) == b"\x89PNG\r\n\x1a\n"
# --8<-- [end:photo_ranges]
# --8<-- [start:photo_copy_embedded]
selected = (
photos.search()
.where("label = 'red'")
.select(["id", "label", "image"])
.limit(10)
.to_arrow(blob_mode="bytes")
)
db.create_table("photo_subset", data=selected, schema=schema)
# --8<-- [end:photo_copy_embedded]
# --8<-- [start:photo_verify]
photo_subset = db.open_table("photo_subset")
assert photo_subset.count_rows() == 1
copied = (
photo_subset.search()
.select(["id", "label"])
.with_row_id(True)
.limit(10)
.to_list()
)
assert [(row["id"], row["label"]) for row in copied] == [(1, "red")]
copied_bytes = photo_subset.fetch_blobs(
"image", [row["_rowid"] for row in copied]
).to_pylist()
assert copied_bytes == [(inputs / "red.png").read_bytes()]
# --8<-- [end:photo_verify]
def enterprise_connection():
# --8<-- [start:photo_connect_enterprise]
import os
import lancedb
db = lancedb.connect(
os.environ["LANCEDB_URI"],
api_key=os.environ["LANCEDB_API_KEY"],
region=os.environ["LANCEDB_REGION"],
host_override=os.environ["LANCEDB_HOST_OVERRIDE"],
sql_host_override=os.environ["LANCEDB_SQL_HOST_OVERRIDE"],
)
# --8<-- [end:photo_connect_enterprise]
return db
def copy_with_enterprise_sql(db):
# --8<-- [start:photo_copy_sql]
db.execute_query(
"CREATE TABLE photo_subset (id BIGINT, label VARCHAR, image BLOB)"
).read_all()
db.execute_query(
"INSERT INTO photo_subset (id, label, image) "
"SELECT id, label, image FROM photos WHERE label = 'red'"
).read_all()
# --8<-- [end:photo_copy_sql]
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -10,7 +10,7 @@
"node": ">=22.6.0"
},
"dependencies": {
"@lancedb/lancedb": "0.41.0-beta.8",
"@lancedb/lancedb": "0.42.0-beta.20",
"apache-arrow": "21.2.0"
}
}
+28 -14
View File
@@ -14,7 +14,7 @@ creates both under names unique to its run, never replaces an existing object,
and drops only what it created.
The other tests run locally and check the client side of the same code: what
`@udf` sends for registration, how a registered version binds a column, where a
`@function` sends for registration, how a registered version binds a column, where a
local connection stops, and when the Enterprise test connects. They do not run
a Function remotely.
"""
@@ -32,10 +32,10 @@ from lancedb import col
from lancedb.functions import FunctionApplication, FunctionVersion
# --8<-- [start:function_define]
from lancedb import udf
from lancedb import function
@udf
@function
def double(value: float) -> float:
return value * 2
@@ -52,7 +52,7 @@ def describe(value: float):
# --8<-- [start:function_class_define]
@udf(pip=["sentence-transformers"])
@function(pip=["sentence-transformers"])
class embed:
def __init__(self, model: str = "all-MiniLM-L6-v2"):
# Runs on the worker, once per instance: only the worker needs the package.
@@ -146,7 +146,7 @@ def test_function_output_nullability():
pa.field("half", pa.float64(), nullable=False),
pa.field("note", pa.string(), nullable=True),
]
struct = udf(input_schema=inputs, output_schema=pa.schema(fields))(describe)
struct = function(input_schema=inputs, output_schema=pa.schema(fields))(describe)
output = struct.registration_request.signature.output
assert output.kind == "named_struct"
assert [(field.name, field.nullable) for field in output.fields] == [
@@ -154,13 +154,27 @@ def test_function_output_nullability():
("note", True),
]
# A scalar output, and a struct declared as one nullable field, may not be.
for nullable in (
pa.field("result", pa.float64(), nullable=True),
pa.field("result", pa.struct(fields), nullable=True),
):
with pytest.raises(ValueError, match="non-nullable"):
udf(input_schema=inputs, output_schema=nullable)(describe)
# A scalar output may be nullable.
@function(input_schema=inputs)
def maybe_double(value: float) -> float | None:
return None if value == 0 else value * 2
output = maybe_double.registration_request.signature.output
assert (output.kind, output.arrow_type, output.nullable) == (
"scalar",
"float64",
True,
)
assert json.loads(maybe_double.registration_request.signature.to_canonical_json())[
"output"
] == {"kind": "scalar", "arrow_type": "float64", "nullable": True}
# A struct declared as one nullable field may not be.
with pytest.raises(ValueError, match="non-nullable"):
function(
input_schema=inputs,
output_schema=pa.field("result", pa.struct(fields), nullable=True),
)(describe)
def test_function_registration_is_remote(tmp_path):
@@ -242,8 +256,8 @@ def test_function_enterprise(monkeypatch):
# this run creates both under names only it uses, and drops only those.
run = uuid.uuid4().hex[:12]
table_name = f"function_demo_{run}"
double = udf(name=f"double_{run}")(WALKTHROUGH_DOUBLE.__wrapped__)
embed = udf(name=f"embed_{run}", pip=["sentence-transformers"])(
double = function(name=f"double_{run}")(WALKTHROUGH_DOUBLE.__wrapped__)
embed = function(name=f"embed_{run}", pip=["sentence-transformers"])(
WALKTHROUGH_EMBED.__wrapped__
)
create_table = db.create_table
+77
View File
@@ -561,6 +561,83 @@ def test_scalar_index_uuid(tmp_db):
assert len(result) == n + len(new_users)
def test_scalar_index_rtree(tmp_db):
db = tmp_db
# --8<-- [start:scalar_index_rtree_data]
import pyarrow as pa
point = pa.struct([("x", pa.float64()), ("y", pa.float64())])
schema = pa.schema(
[
pa.field("name", pa.string()),
pa.field(
"location", point, metadata={"ARROW:extension:name": "geoarrow.point"}
),
pa.field("vector", pa.list_(pa.float32(), 2)),
]
)
places = [
("Ferry Building", -122.3937, 37.7955, [0.7, 0.3]),
("Golden Gate Park", -122.4862, 37.7694, [0.1, 0.9]),
("Oakland Museum", -122.2638, 37.7987, [1.0, 0.05]),
]
data = pa.Table.from_pylist(
[
{"name": name, "location": {"x": x, "y": y}, "vector": vector}
for name, x, y, vector in places
],
schema=schema,
)
table = db.create_table("places", data)
# --8<-- [end:scalar_index_rtree_data]
# --8<-- [start:scalar_index_rtree_create]
from lancedb.index import RTree
table.create_index("location", config=RTree())
# --8<-- [end:scalar_index_rtree_create]
# --8<-- [start:scalar_index_rtree_filter]
san_francisco = (
"ST_GeomFromText('POLYGON ((-122.52 37.70, -122.35 37.70, "
"-122.35 37.83, -122.52 37.83, -122.52 37.70))')"
)
in_san_francisco = f"ST_Within(location, {san_francisco})"
places_in_sf = table.search().where(in_san_francisco).select(["name"]).to_list()
# [{'name': 'Ferry Building'}, {'name': 'Golden Gate Park'}]
# --8<-- [end:scalar_index_rtree_filter]
assert sorted(row["name"] for row in places_in_sf) == [
"Ferry Building",
"Golden Gate Park",
]
# --8<-- [start:scalar_index_rtree_vector]
# The nearest place overall is in Oakland; the spatial prefilter keeps the
# search inside San Francisco.
nearest_in_sf = (
table.search([1.0, 0.0])
.where(in_san_francisco)
.select(["name", "_distance"])
.limit(1)
.to_list()
)
# [{'name': 'Ferry Building', '_distance': 0.18}]
# --8<-- [end:scalar_index_rtree_vector]
assert nearest_in_sf[0]["name"] == "Ferry Building"
assert nearest_in_sf[0]["_distance"] == pytest.approx(0.18, abs=1e-6)
nearest = table.search([1.0, 0.0]).select(["name", "_distance"]).limit(1)
assert nearest.to_list()[0]["name"] == "Oakland Museum"
# --8<-- [start:scalar_index_rtree_explain]
plan = table.search().where(in_san_francisco).explain_plan(verbose=True)
assert "ScalarIndexQuery" in plan
# --8<-- [end:scalar_index_rtree_explain]
@pytest.mark.asyncio
async def test_scalar_index_nested_fields(mem_db_async):
db = mem_db_async
+15 -1
View File
@@ -1328,7 +1328,8 @@ def test_versioning_tags(tmp_db):
# --8<-- [start:versioning_tags]
# Create a tag pointing at a specific version
table.tags.create("baseline", 1)
table.tags.create("with-edits", table.version)
# Omit version to tag the version this handle currently shows.
table.tags.create("with-edits")
# List all tags on this table
print(table.tags.list())
@@ -1343,6 +1344,9 @@ def test_versioning_tags(tmp_db):
table.checkout("baseline")
print(table.version)
# A checked-out handle tags the older version it shows, not the latest.
table.tags.create("baseline-checkout")
# Delete a tag (does not delete the underlying version)
table.tags.delete("with-edits")
@@ -1350,6 +1354,7 @@ def test_versioning_tags(tmp_db):
table.checkout_latest()
# --8<-- [end:versioning_tags]
assert table.version == 3
assert table.tags.get_version("baseline-checkout") == 2
assert "baseline" in table.tags.list()
assert "with-edits" not in table.tags.list()
@@ -1387,8 +1392,15 @@ def test_branches(tmp_db):
# Fork an isolated, writable branch from main's latest version.
# `create` returns a table handle scoped to the new branch.
branch = table.branches.create("exp")
# Fork from a tag. `from_tag` is keyword-only and cannot be combined with
# `from_ref` or `from_version`.
table.tags.create("baseline", 1)
tag_branch = table.branches.create("exp-from-tag", from_tag="baseline")
# --8<-- [end:branch_create]
assert tag_branch.count_rows() == 3
# --8<-- [start:branch_write]
# Writes land on the branch handle only; main is left untouched.
branch.add([{"id": 4, "author": "Lancelot", "quote": "For the realm!"}])
@@ -1414,6 +1426,8 @@ def test_branches(tmp_db):
assert table.count_rows() == 3
assert "exp" not in table.branches.list()
assert "exp-from-tag" in table.branches.list()
table.branches.delete("exp-from-tag")
# Setup: a branch with row results that we want to apply to main.
candidate = table.branches.create("candidate")
+70 -235
View File
@@ -87,9 +87,9 @@ checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
[[package]]
name = "anyhow"
version = "1.0.102"
version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"
[[package]]
name = "ar_archive_writer"
@@ -129,9 +129,9 @@ checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb"
[[package]]
name = "arrayvec"
version = "0.7.6"
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"
[[package]]
name = "arrow"
@@ -683,9 +683,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
version = "1.11.1"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
[[package]]
name = "cast"
@@ -1019,9 +1019,9 @@ dependencies = [
[[package]]
name = "crossbeam-epoch"
version = "0.9.18"
version = "0.9.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d"
dependencies = [
"crossbeam-utils",
]
@@ -1904,7 +1904,7 @@ dependencies = [
"libc",
"option-ext",
"redox_users",
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
@@ -1993,7 +1993,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
@@ -2004,11 +2004,10 @@ checksum = "40404c3f5f511ec4da6fe866ddf6a717c309fdbb69fbbad7b0f3edab8f2e835f"
[[package]]
name = "event-listener"
version = "5.4.1"
version = "5.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab"
checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2"
dependencies = [
"concurrent-queue",
"parking",
"pin-project-lite",
]
@@ -2289,17 +2288,15 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.4.2"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555"
checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"r-efi 6.0.0",
"rand_core 0.10.1",
"wasip2",
"wasip3",
"wasm-bindgen",
]
@@ -2317,9 +2314,9 @@ checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
[[package]]
name = "h2"
version = "0.4.12"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386"
checksum = "7d29020232d6aa3fb1daca64c1127cf662cf97f254ae16c18c05b8ab635fc118"
dependencies = [
"atomic-waker",
"bytes",
@@ -2475,9 +2472,9 @@ checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424"
[[package]]
name = "hyper"
version = "1.8.1"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11"
checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c"
dependencies = [
"atomic-waker",
"bytes",
@@ -2490,7 +2487,6 @@ dependencies = [
"httpdate",
"itoa",
"pin-project-lite",
"pin-utils",
"smallvec",
"tokio",
"want",
@@ -2699,12 +2695,6 @@ version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4a2c462a4d927d512f5f882a033ddd62f33a05bb9f230d98f736ac3dc85938f"
[[package]]
name = "id-arena"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
[[package]]
name = "ident_case"
version = "1.0.1"
@@ -2808,7 +2798,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"
dependencies = [
"hermit-abi",
"libc",
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
@@ -2876,7 +2866,7 @@ dependencies = [
"portable-atomic",
"portable-atomic-util",
"serde_core",
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
@@ -2917,11 +2907,12 @@ dependencies = [
[[package]]
name = "js-sys"
version = "0.3.83"
version = "0.3.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8"
checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a"
dependencies = [
"once_cell",
"cfg-if",
"futures-util",
"wasm-bindgen",
]
@@ -3607,12 +3598,6 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "leb128fmt"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
[[package]]
name = "lexical-core"
version = "1.0.6"
@@ -3694,9 +3679,9 @@ dependencies = [
[[package]]
name = "libsais-rs"
version = "0.2.0"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40fe164dbd47ea0c20e78a121c980ef673326905f1d4fba55e3645a20ef6717f"
checksum = "ec55b7be74ed721889b8bc62d53e6a032d2b3b9bb60a4942b45b1e8362e64583"
dependencies = [
"rayon",
]
@@ -3925,9 +3910,9 @@ dependencies = [
[[package]]
name = "mio"
version = "1.1.1"
version = "1.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc"
checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee"
dependencies = [
"libc",
"wasi",
@@ -3936,9 +3921,9 @@ dependencies = [
[[package]]
name = "moka"
version = "0.12.11"
version = "0.12.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8261cd88c312e0004c1d51baad2980c66528dfdb2bee62003e643a4d8f86b077"
checksum = "4293f18e7567a1caf3c584855554377025c65e0aa445344d04171f5ad63d19b9"
dependencies = [
"async-lock",
"crossbeam-channel",
@@ -3949,7 +3934,6 @@ dependencies = [
"futures-util",
"parking_lot",
"portable-atomic",
"rustc_version",
"smallvec",
"tagptr",
"uuid",
@@ -4062,7 +4046,7 @@ version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
@@ -4919,7 +4903,7 @@ version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7"
dependencies = [
"heck 0.5.0",
"heck 0.4.1",
"itertools 0.14.0",
"log",
"multimap",
@@ -5020,7 +5004,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e750cca55fe4f0439a15d0bb529da9651e79993e8e72c61a899a36d462befbe"
dependencies = [
"bytes",
"getrandom 0.4.2",
"getrandom 0.4.3",
"lru-slab",
"rand 0.10.3",
"rand_pcg",
@@ -5046,7 +5030,7 @@ dependencies = [
"once_cell",
"socket2",
"tracing",
"windows-sys 0.60.2",
"windows-sys 0.59.0",
]
[[package]]
@@ -5113,7 +5097,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af"
dependencies = [
"chacha20",
"getrandom 0.4.2",
"getrandom 0.4.3",
"rand_core 0.10.1",
]
@@ -5520,14 +5504,14 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys 0.11.0",
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
name = "rustls"
version = "0.23.45"
version = "0.23.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634"
checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf"
dependencies = [
"once_cell",
"ring",
@@ -5861,9 +5845,9 @@ checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589"
[[package]]
name = "smallvec"
version = "1.15.1"
version = "1.16.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46"
[[package]]
name = "smartstring"
@@ -5900,7 +5884,7 @@ version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1c97747dbf44bb1ca44a561ece23508e99cb592e862f22222dcf42f51d1e451"
dependencies = [
"heck 0.5.0",
"heck 0.4.1",
"proc-macro2",
"quote",
"syn 2.0.117",
@@ -5912,7 +5896,7 @@ version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f103c50866b8743da9429b8a581d81a27c2d3a9c4ac7df8f8571c1dd7896eda"
dependencies = [
"heck 0.5.0",
"heck 0.4.1",
"proc-macro2",
"quote",
"syn 2.0.117",
@@ -6247,7 +6231,7 @@ dependencies = [
"getrandom 0.3.4",
"once_cell",
"rustix 1.1.2",
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
@@ -6301,9 +6285,9 @@ dependencies = [
[[package]]
name = "thread_local"
version = "1.1.9"
version = "1.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185"
checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070"
dependencies = [
"cfg-if",
]
@@ -6371,18 +6355,9 @@ dependencies = [
[[package]]
name = "tinyvec"
version = "1.10.0"
version = "1.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa"
dependencies = [
"tinyvec_macros",
]
[[package]]
name = "tinyvec_macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee"
[[package]]
name = "tokio"
@@ -6646,12 +6621,6 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
[[package]]
name = "unicode-xid"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
[[package]]
name = "unsafe-libyaml"
version = "0.2.11"
@@ -6700,7 +6669,7 @@ version = "1.23.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d258b83ceec21034727ecee8c382cfa6c3e133699b0742c64571814fb420c9f7"
dependencies = [
"getrandom 0.4.2",
"getrandom 0.4.3",
"js-sys",
"serde_core",
"sha1_smol",
@@ -6731,9 +6700,9 @@ dependencies = [
[[package]]
name = "want"
version = "0.3.1"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b"
dependencies = [
"try-lock",
]
@@ -6750,26 +6719,16 @@ version = "1.0.1+wasi-0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7"
dependencies = [
"wit-bindgen 0.46.0",
]
[[package]]
name = "wasip3"
version = "0.4.0+wasi-0.3.0-rc-2026-01-06"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5"
dependencies = [
"wit-bindgen 0.51.0",
"wit-bindgen",
]
[[package]]
name = "wasm-bindgen"
version = "0.2.106"
version = "0.2.130"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd"
checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c"
dependencies = [
"cfg-if",
"once_cell",
"rustversion",
"wasm-bindgen-macro",
"wasm-bindgen-shared",
@@ -6777,22 +6736,20 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.56"
version = "0.4.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "836d9622d604feee9e5de25ac10e3ea5f2d65b41eac0d9ce72eb5deae707ce7c"
checksum = "5e14e0327cb5368ad60ccb22d04a9827a693c95a926d8d125e9fa39e0baec501"
dependencies = [
"cfg-if",
"js-sys",
"once_cell",
"tokio",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.106"
version = "0.2.130"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3"
checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -6800,48 +6757,26 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.106"
version = "0.2.130"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40"
checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a"
dependencies = [
"bumpalo",
"proc-macro2",
"quote",
"syn 2.0.117",
"syn 3.0.6",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.106"
version = "0.2.130"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4"
checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e"
dependencies = [
"unicode-ident",
]
[[package]]
name = "wasm-encoder"
version = "0.244.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319"
dependencies = [
"leb128fmt",
"wasmparser",
]
[[package]]
name = "wasm-metadata"
version = "0.244.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909"
dependencies = [
"anyhow",
"indexmap 2.14.0",
"wasm-encoder",
"wasmparser",
]
[[package]]
name = "wasm-streams"
version = "0.4.2"
@@ -6855,23 +6790,11 @@ dependencies = [
"web-sys",
]
[[package]]
name = "wasmparser"
version = "0.244.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe"
dependencies = [
"bitflags 2.10.0",
"hashbrown 0.15.5",
"indexmap 2.14.0",
"semver",
]
[[package]]
name = "web-sys"
version = "0.3.83"
version = "0.3.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac"
checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -6909,7 +6832,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
@@ -7254,94 +7177,6 @@ version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
[[package]]
name = "wit-bindgen"
version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
dependencies = [
"wit-bindgen-rust-macro",
]
[[package]]
name = "wit-bindgen-core"
version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc"
dependencies = [
"anyhow",
"heck 0.5.0",
"wit-parser",
]
[[package]]
name = "wit-bindgen-rust"
version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21"
dependencies = [
"anyhow",
"heck 0.5.0",
"indexmap 2.14.0",
"prettyplease",
"syn 2.0.117",
"wasm-metadata",
"wit-bindgen-core",
"wit-component",
]
[[package]]
name = "wit-bindgen-rust-macro"
version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a"
dependencies = [
"anyhow",
"prettyplease",
"proc-macro2",
"quote",
"syn 2.0.117",
"wit-bindgen-core",
"wit-bindgen-rust",
]
[[package]]
name = "wit-component"
version = "0.244.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2"
dependencies = [
"anyhow",
"bitflags 2.10.0",
"indexmap 2.14.0",
"log",
"serde",
"serde_derive",
"serde_json",
"wasm-encoder",
"wasm-metadata",
"wasmparser",
"wit-parser",
]
[[package]]
name = "wit-parser"
version = "0.244.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736"
dependencies = [
"anyhow",
"id-arena",
"indexmap 2.14.0",
"log",
"semver",
"serde",
"serde_derive",
"serde_json",
"unicode-xid",
"wasmparser",
]
[[package]]
name = "writeable"
version = "0.6.2"
@@ -7388,18 +7223,18 @@ dependencies = [
[[package]]
name = "zerocopy"
version = "0.8.31"
version = "0.8.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3"
checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.8.31"
version = "0.8.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a"
checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f"
dependencies = [
"proc-macro2",
"quote",
+4
View File
@@ -1,3 +1,7 @@
# Standalone crate pinned to a published lancedb release, not part of the root
# workspace. Without this, cargo commands here fail to resolve the workspace.
[workspace]
[package]
name = "rs"
version = "0.1.0"
+19 -1
View File
@@ -1379,17 +1379,27 @@ async fn main() {
.await
.unwrap();
// --8<-- [start:branch_create]
use lancedb::table::Ref;
// --8<-- [start:branch_create]
// Fork an isolated, writable branch from main's latest version.
// `create_branch` returns a table handle scoped to the new branch.
let branch = branches_table
.create_branch("exp", Ref::Version(None, None))
.await
.unwrap();
// Fork from a tag. A tag keeps its branch and version.
let mut tags = branches_table.tags().await.unwrap();
tags.create("baseline", 1).await.unwrap();
let tag_branch = branches_table
.create_branch("exp-from-tag", Ref::Tag("baseline".to_string()))
.await
.unwrap();
// --8<-- [end:branch_create]
assert_eq!(tag_branch.count_rows(None).await.unwrap(), 3);
// --8<-- [start:branch_write]
// Writes land on the branch handle only; main is left untouched.
branch
@@ -1428,6 +1438,14 @@ async fn main() {
assert_eq!(branches_table.count_rows(None).await.unwrap(), 3);
assert!(!branches_table.list_branches().await.unwrap().contains_key("exp"));
assert!(
branches_table
.list_branches()
.await
.unwrap()
.contains_key("exp-from-tag")
);
branches_table.delete_branch("exp-from-tag").await.unwrap();
// Setup: a branch with row results that we want to apply to main.
let candidate = branches_table
+7
View File
@@ -0,0 +1,7 @@
# Branching is Beta; not documented until early access. tables/branching.mdx
# stays reachable (out of the nav only): SDK error messages link to it.
# To restore: docs.json Tutorials > Feature Engineering, after tutorials/feature-engineering/materialized-views.
agent-branch-experiments.mdx
# JSON columns are Beta; not documented until early access.
# To restore: docs.json Documentation > SQL Reference > DQL, after sql/dql/vector-distance.
sql/dql/json-functions.mdx
+18
View File
@@ -78,6 +78,24 @@ Not every agent supports project scope; `npx plugins targets` lists what it
found and what each target supports.
</Accordion>
## Automated prompt catalog {#automated-prompts}
Explore the prompts covered by automated agent evaluations. Each prompt uses
example data and may require existing tables,
indexes, metadata, branches, version history, or running jobs. Replace the test
fixtures and connection details with your own before using a prompt.
The evaluations run against a LanceDB Enterprise test database, with and
without the agent plugin. Evaluation coverage does not guarantee success for
every agent or model.
Prompts are reproduced verbatim, including the answer formats used by automated
grading. Table names, local files, and placeholders in these prompts refer to
test fixtures. Supply your own data, database connection, and timestamps when
adapting them.
{/* agent-eval-catalog */}
## Example prompts {#example-prompts}
These prompts show the kind of work the plugin helps an agent get right on
+20 -2
View File
@@ -53,7 +53,7 @@ a nested `search` namespace:
%%{init: {"theme": "base", "themeVariables": {
"background": "#171513", "primaryColor": "#1e1b19", "primaryTextColor": "#f4ebe8",
"primaryBorderColor": "#4c443f", "lineColor": "#847770", "textColor": "#f4ebe8",
"edgeLabelBackground": "#171513", "fontFamily": "Inter, sans-serif", "fontSize": "15px"
"edgeLabelBackground": "#171513", "fontFamily": "Inter, sans-serif", "fontSize": "18px"
}}}%%
flowchart TD
catalog["root catalog"] --> database["ai_data · database"]
@@ -75,7 +75,7 @@ flowchart TD
%%{init: {"theme": "base", "themeVariables": {
"background": "#ffffff", "primaryColor": "#ffffff", "primaryTextColor": "#221d19",
"primaryBorderColor": "#ad9e95", "lineColor": "#6b625c", "textColor": "#221d19",
"edgeLabelBackground": "#ffffff", "fontFamily": "Inter, sans-serif", "fontSize": "15px"
"edgeLabelBackground": "#ffffff", "fontFamily": "Inter, sans-serif", "fontSize": "18px"
}}}%%
flowchart TD
catalog["root catalog"] --> database["ai_data · database"]
@@ -158,6 +158,24 @@ list, create and drop databases across the whole deployment. Its
`connect_database(name)` and `create_database(name)` then return the same
kind of database connection `lancedb.connect()` does.
In Python, `connect_catalog` and `connect_catalog_async` accept the same
connection settings as their database counterparts. Use `host_override` to
share settings that include a `db://` URI; the catalog connection targets
the root of that deployment and ignores the database name. An explicitly
supplied `region` is ignored with a warning, since the HTTP(S) endpoint
selects the deployment. Embedded-only session and namespace settings are
unsupported.
```python
settings = {
"uri": "db://analytics",
"api_key": "secret",
"host_override": "https://my-server.example",
}
db = lancedb.connect(**settings)
catalog = lancedb.connect_catalog(**settings)
```
This connection is for database administration, not table or query work:
list, create and drop databases through it, then switch to a **database**
connection for everything else -- tables, queries, and SQL all run within a
+186
View File
@@ -0,0 +1,186 @@
---
title: "Embedded vs Enterprise"
sidebarTitle: "Embedded vs Enterprise"
description: "A feature-by-feature comparison between LanceDB Embedded and LanceDB Enterprise."
icon: "scale-balanced"
keywords: ["embedded vs enterprise", "comparison", "oss vs enterprise"]
---
LanceDB Embedded runs in your application's process; your data can live on local disk or in object storage.
[LanceDB Enterprise](/enterprise/index) distributes query execution, indexing, maintenance and refresh work across
a cluster of many machines, outside your application. Both are built on the same [Lance](/basics/lance) columnar
file format, so moving data from one edition to the other does not require a data conversion step. See
[Architecture](/index#architecture) for how each one's components fit together.
## How they differ {#how-they-differ}
| Dimension | LanceDB Embedded | LanceDB Enterprise | What the difference means |
|:----------|:------------|:-------------------|:-------------------------|
| **Mode** | Single process | Distributed fleet | LanceDB Embedded runs on one host, so scale is limited to what it can provide. Enterprise spreads work across nodes, adds capacity by adding nodes, and keeps serving even if one node fails. |
| **Query serving** | Uses the resources of your application process | Adds independently scaled query compute | Size the Enterprise cluster for your workload and latency target. See the expected-performance sections on [vector search](/search/vector-search#expected-performance) and [full-text search](/search/full-text-search#expected-performance) for representative measurements. |
| **Cache** | In-process index and metadata caches | Adds a distributed NVMe data cache | LanceDB Embedded caches indexes and metadata in your application's memory. Enterprise also keeps hot table data near compute on NVMe and avoids repeated S3 calls -- see the [Data Page Cache](/enterprise/data-page-cache). |
| **Indexing & compaction** | Manual | Platform-managed workflows and explicit compaction | LanceDB Embedded requires application-managed maintenance; Enterprise schedules it in the background. See [Indexing in LanceDB](/indexing/). |
| **Data format** | Lance | Lance | Both use the same open table format. Plan catalog registration, access and transfer when moving existing data. |
| **Deployment** | Embedded in your code | BYOC or Managed | Enterprise adds deployment operations and support for shared workloads. |
| **SQL analytics** | Not available | Arrow Flight SQL | Enterprise runs joins, grouping, sampling and [curation](/curation) over SQL. See [SQL reference](/sql). |
| **Native vector dedup** | Not available | `dedupe()` / `duplicate_pairs()` | Index-partition deduplication as a SQL table function, with no full pairwise scan. See [DEDUPE](/sql/dql/dedupe). |
| **Materialized views** | Not available | Server-side, distributed compute | Enterprise derives and refreshes a table from a query as a background job. See [Materialized views](/feature-engineering/materialized-views). |
## Compare features {#compare}
| Area | Feature | Embedded | Enterprise |
| --- | --- | :-: | :-: |
| **Data Ingestion** | [Insert data](/ingestion/insert) | ✅ | ✅ |
| | [RTE Write (Upsert)](/ingestion/realtime-write) | ✅ | ✅ |
| | [Distributed RTE Write](/enterprise/distributed-real-time-write) | ❌ | ✅ |
| | [Attach Database](/ingestion/attach-database) | ❌ | ✅ |
| | [Import Datasets](/ingestion/import) | ❌ | ✅ |
| | [Distributed Write](/enterprise/distributed-write) | ❌ | ✅ |
| **Search** | [Vector search](/search/vector-search) | ✅ | ✅ |
| | [Full-text search](/search/full-text-search) | ✅ | ✅ |
| | [Hybrid search](/search/hybrid-search) | ✅ | ✅ |
| | [Filtering](/search/filtering) | ✅ | ✅ |
| | [Reranking](/reranking) | ✅ | ✅ |
| | [Distributed Search](/enterprise/distributed-search) | ❌ | ✅ |
| | [RTE Read](/search/realtime-read) | ✅ | ✅ |
| | [Distributed RTE Read](/enterprise/distributed-real-time-read) | ❌ | ✅ |
| | [Cache Prewarm](/enterprise/cache-prewarm) | ❌ | ✅ |
| **Data Curation** | [Inspect Datasets](/curation/inspect-datasets) | ❌ | ✅ |
| | [Statistical Sampling](/curation/statistical-sampling) | ❌ | ✅ |
| | [Selective Sampling](/curation/selective-sampling) | ✅ | ✅ |
| | [Aggregation and profiling](/curation/aggregate) | ❌ | ✅ |
| | [Joins](/curation/join) | ❌ | ✅ |
| | [Blob Late Materialization](/curation/blob-late-materialization) | ❌ | ✅ |
| | [Ranking](/curation/windowing) | ❌ | ✅ |
| | [Near-duplicate detection](/curation/dedupe) | ❌ | ✅ |
| | [Chunking](/curation/chunking) | ❌ | ✅ |
| | [Changes since a version](/curation/changes) | ❌ | ✅ |
| **Feature Engineering** | [Computed columns](/feature-engineering/add-computed-column) | ❌ | ✅ |
| | [Incremental Refresh](/enterprise/incremental-refresh) | ❌ | ✅ |
| | [Auto Refresh](/enterprise/auto-refresh) | ❌ | ✅ |
| | [Checkpointing](/enterprise/checkpointing) | ❌ | ✅ |
| | [Adaptive Execution](/enterprise/adaptive-execution) | ❌ | ✅ |
| | [Refresh Materialized View](/feature-engineering/refresh-materialized-view) | ❌ | ✅ |
| | [Embedding registry](/embedding) | ✅ | ✅ |
| **Training** | [PyTorch data loader](/training/data-loading) | ✅ | ✅ |
| | [Training Cache](/training/training-cache) | ❌ | ✅ |
| | [Permutations](/training/permutation) | ✅ | ✅ |
| | [Distributed training](/training/distributed-training) | ✅ | ✅ |
| | [Observability](/training/observability) | ✅ | ✅ |
| | [Checkpointing](/training/checkpointing) | ✅ | ✅ |
| | [Resuming](/training/resuming) | ✅ | ✅ |
| **Management** | [Catalog](/management/catalog) | ❌ | ✅ |
| | [Database](/management/database) | ✅ | ✅ |
| | [Namespace](/management/namespace) | ✅ | ✅ |
| | [Table](/management/table) | ✅ | ✅ |
| | [View](/management/view) | ❌ | ✅ |
| | [Materialized view](/management/materialized-view) | ❌ | ✅ |
| | [Secret](/management/secret) | ❌ | ✅ |
| | [Function](/management/function) | ❌ | ✅ |
| | [Storage integration](/management/storage-integration) | ❌ | ✅ |
| | [Console](/enterprise/console) | ❌ | ✅ |
| **Maintenance** | [Intelligent Auto-Maintenance](/enterprise/intelligent-auto-maintenance) | ❌ | ✅ |
| | [Vector Indexing](/indexing/vector-index) | ✅ | ✅ |
| | [FTS Indexing](/indexing/fts-index) | ✅ | ✅ |
| | [Scalar Indexing](/indexing/scalar-index) | ✅ | ✅ |
| | [Incremental Indexing](/indexing/incremental-indexing) | ✅ | ✅ |
| | [Distributed Indexing](/enterprise/distributed-indexing) | ❌ | ✅ |
| | [GPU Indexing](/indexing/gpu-indexing) | ✅ | ✅ |
| | [Compaction](/maintenance/compaction) | ✅ | ✅ |
| | [RTE Compaction](/enterprise/realtime-engine-compaction) | ❌ | ✅ |
| | [Garbage Collection](/maintenance/cleanup) | ✅ | ✅ |
| | [Distributed Compaction](/enterprise/distributed-compaction) | ❌ | ✅ |
| | [Advanced Conflict Resolution](/enterprise/advanced-conflict-resolution) | ❌ | ✅ |
| **Security** | [Authentication](/enterprise/authentication) | ❌ | ✅ |
| | [Authorization](/governance/authorization) | ❌ | ✅ |
| | [Audit Log](/governance/audit-log) | ❌ | ✅ |
| **Deployment** | [Horizontal Scaling](/enterprise/horizontal-scaling) | ❌ | ✅ |
| | [OpenTelemetry](/deployment/opentelemetry) | ✅ | ✅ |
| | [Kubernetes](/enterprise/deployment/kubernetes) | ❌ | ✅ |
| | [Multicloud](/deployment/multicloud) | ❌ | ✅ |
| | [Slurm](/deployment/slurm) | ❌ | ✅ |
{/*
Draft until branching reaches early access; restore to the Management rows.
| | [Branches](/tables/branching) | ✅ | ✅ |
*/}
## Usage differences between Enterprise and Embedded {#usage-differences-between-enterprise-and-oss}
The [quickstart](/quickstart) guide shows both LanceDB Embedded connections and Enterprise `db://...`
connections. Once connected to LanceDB, the table API is largely the same: create a table, search,
filter, evolve the schema, and store multimodal records. However, there are some semantic differences
worth understanding when your code is talking to LanceDB Enterprise.
### 1\. Connection model {#1-connection-model}
In LanceDB Enterprise, your app connects via a `db://...` URI and sends requests to the cluster API.
The cluster executes table operations on your behalf. Your code is coupled to a **managed service endpoint**,
whereas LanceDB Embedded is directly coupled to local or object-storage paths.
### 2\. Returned table type {#2-returned-table-type}
Connecting to an Enterprise table via `open_table(...)` returns a `RemoteTable`, unlike LanceDB Embedded,
which returns a `LanceTable`. `RemoteTable` is a catalog-backed table accessed through a server/cluster,
and does not support all the same methods as `LanceTable` (see below).
### 3\. Materialization APIs {#3-materialization-apis}
For Python users working with LanceDB Enterprise, `RemoteTable` does not support table-level
materialization methods like `table.to_arrow()` or `table.to_pandas()`. This protects users from
accidentally materializing tables that are too large to fit in memory.
Instead, materialize results through query/search builders, for example
`table.search(...).limit(...).to_pandas()` for a vector or full-text search, or
`table.search().where(...).limit(...).to_arrow()` for a filtered scan. For quick previews, use
`table.head()`.
### 4\. Maintenance lifecycle {#4-maintenance-lifecycle}
In LanceDB Embedded, `optimize()` compacts data files, adds new rows to existing
indexes, and removes old table versions. LanceDB Enterprise schedules that work
through separate background jobs and also accepts explicit compaction requests
with compatible releases.
Python sync/async `compact_async()`, TypeScript `compactAsync()`, and Rust
`Table::compact_async(CompactionOverrides)` return durable compaction job handles;
waiting returns the committed rewrite statistics. Legacy remote `optimize()`
and Rust `Table::compact()` return after submission with placeholder counts.
Remote optimize does not prune versions or optimize indexes;
explicit requests for those unsupported operations are rejected. The synchronous
Python `compact_files()` and `cleanup_old_versions()` helpers remain warning-only
no-ops in LanceDB Enterprise.
Manual compaction accepts four invocation options and inherits omitted fields
from the selected branch's table tuning, then deployment/built-in defaults.
Automatic-compaction enablement gates background scheduling while explicit
manual jobs can still run. See
[manual Enterprise compaction](/maintenance/compaction#enterprise-manual-compaction)
for CLI, SQL, and SDK examples and rollout requirements.
### 5\. Guardrails and limits {#5-guardrails-and-limits}
Enterprise can enforce platform-level guardrails, such as index/table limits and safety checks around
operations like `merge_insert` when too many rows are unindexed. LanceDB Embedded mostly exposes
storage/format-level behavior, and you tune many lifecycle tasks yourself.
This means an operation in LanceDB Enterprise can fail due to service-level policy, not just because
of local table shape or schema mismatch.
<Info>
As a rule of thumb, all you need to remember is this: treat `db://...` as a network service boundary,
use query builders to fetch results, and otherwise interact with your tables as you would in LanceDB
Embedded.
</Info>
## Which one should I use? {#which-one-should-i-use}
[It's very simple to get started with LanceDB Embedded](/quickstart/): Get started with `pip install lancedb` and begin ingesting
your data and vectors into LanceDB. LanceDB Embedded (open source) makes sense when your dataset fits on one machine, traffic is still
modest, and your team is comfortable handling maintenance tasks such as compaction or reindexing itself.
Move to LanceDB Enterprise when retrieval becomes shared infrastructure for your business: your data or traffic has
outgrown a single machine, you need private deployment options, or you want platform support for monitoring, security,
and large-scale feature workflows.
If these sound like your use cases, [reach out to us](https://www.lancedb.com/contact) and we can help you scope your workload and arrange an Enterprise proof of concept.
+194 -41
View File
@@ -5,7 +5,7 @@ description: "Track background work from submission to completion."
icon: hourglass-half
keywords: ["job", "background", "progress", "events", "cancel"]
availability:
embedded: available
embedded: unavailable
enterprise: available
---
@@ -33,6 +33,46 @@ print(job.status())
```
</CodeGroup>
## Cached properties and live calls {#snapshots}
Python job properties describe the last observation; reading them does not
contact the server. Submission need not fetch the full registry record, so
some properties can initially be `None`.
| Surface | Contract |
| --- | --- |
| `state` | Last observed lifecycle state. It does not update on its own. |
| `job_type`, `creation_ms` | Cached job kind and creation time in epoch milliseconds. |
| `spec` | Complete, job-specific submitted specification. Read this separately from the bounded `repr(job)` display. |
| `result` | Cached, job-specific reported data; it is not necessarily the typed object returned by `wait()`. |
| `failure` | Cached `JobFailureInfo`, when the server reports a terminal failure. |
| `status()` | Live lifecycle request. For registry jobs it also caches the full record. A failed state is returned without raising a job-failure exception; request errors can still raise. |
| `refresh()` | Fetch and cache the current record without waiting for completion. |
| `events(...)` | Separate live request returning a `pyarrow.Table` of recorded events; it does not refresh the properties. |
| `wait(...)` | Poll until completion and return the operation's typed result, or raise on failure/cancellation. Refresh afterward when you need the complete final registry record. |
For example, poll a registry handle and then retrieve its final details:
```python
import time
state = job.status()
while state == "running":
print(job.state)
time.sleep(2)
state = job.status()
result = job.wait()
job.refresh()
print(result)
print(job.spec)
```
The four lifecycle strings below are the usual SDK contract; newer server
states may pass through an older client. Do not infer execution progress from
`state` alone. Structured progress methods and queue fields require matching
SDK/server support; see [refresh admission](/feature-engineering/refresh-column#admission).
## Submit and wait for a job {#waiting}
1. **Submit the operation.** Keep the returned job handle. For an Enterprise
@@ -42,9 +82,21 @@ print(job.status())
result. If it failed or was cancelled, inspect the failure details and any
results it committed before stopping.
In Python, `job.status()` reports the current state and `job.wait()` waits for
completion, raising if the job fails or is cancelled. Both `Job.wait()` and
`AsyncJob.wait()` retry transient connection and read errors with capped
In Python, `job.status()` returns the current state:
| State | Meaning |
| --- | --- |
| `running` | The operation is in progress. |
| `finished` | The operation completed successfully. |
| `failed` | The operation failed. |
| `cancelled` | The operation was cancelled. |
`job.status()` checks the current state without waiting for completion.
It returns `failed` or `cancelled` for unsuccessful jobs.
Use `job.wait()` to wait for completion and raise if the job fails or is
cancelled. Python's `Job.wait()` and `AsyncJob.wait()` retry transient connection
and read errors with capped
exponential backoff within the caller's timeout. Without a timeout, retries
continue indefinitely.
@@ -71,8 +123,33 @@ except ConnectionError as exc:
except TimeoutError:
print(f"still running: {job.status()}")
```
```typescript TypeScript
const result = await job.wait({
timeoutMs: 600_000,
onProgress: progress => console.log(progress),
});
```
```rust Rust
use std::time::Duration;
use lancedb::job::JobWaitOptions;
let result = job.wait_with_options(
JobWaitOptions::new()
.timeout(Duration::from_secs(600))
.progress(|description| println!("{}", description.progress_snapshot())),
).await?;
```
</CodeGroup>
TypeScript's `timeoutMs` and Rust's `JobWaitOptions::timeout` bound the existing
wait poller, including pending status requests and retry/polling delays.
Expiry rejects the TypeScript promise or returns Rust's `Error::Timeout`;
the operation is not cancelled. Calling `wait()` without options still waits
indefinitely. TypeScript's existing `wait(callback)` and Rust's
`wait_with_progress(callback)` remain available. A zero timeout only permits
an immediately ready result. TypeScript timeouts use nonnegative safe-integer
milliseconds; Rust uses `std::time::Duration`.
After connectivity returns, reopen an Enterprise registry job by its saved ID
and continue waiting on the existing operation:
@@ -121,6 +198,76 @@ for info in db.list_jobs(page_limit=50):
```
</CodeGroup>
`list_jobs` yields `JobInfo` summaries, newest creation time first, rather than
live `Job` handles. Open an ID to inspect its full record. `page_limit` bounds
each server request, not the total yielded items, and `page_token` resumes a
listing. It is a lazy iterator: iteration performs requests and can raise
request errors. Use `list(db.list_jobs(...))` to collect all remaining results;
there is no `.to_list()` method.
<Note>
Job filters and synchronous `Listing` indexing, slicing, and `len()` require
a Python SDK release that includes these APIs. Older SDKs expose only
`page_token` and `page_limit`; collect results with `list(...)` before indexing
or counting them. Filtering also requires a matching Enterprise server that
supports the requested filters.
</Note>
Filter jobs on the server before pagination with `table`, `state`, `job_type`
or `job_types`, and creation-time bounds. `table` names a table in
`namespace_path` (the root by default) and includes all its branches. Requests
stay scoped to the connected database. Creation times are Unix milliseconds:
`created_at_gte_millis` is inclusive and `created_at_lt_millis` is exclusive.
Choose either `job_type` or `job_types`.
The `state` filter uses registry states: `in_progress`, `succeeded`, `failed`,
`canceled`, and `timed_out`. These differ from the SDK lifecycle labels such
as `running` and `finished` returned in `JobInfo.state`.
```python
jobs = db.list_jobs(table="events", state="in_progress", page_limit=5)
first_five = jobs[:5]
for info in first_five:
print(info.job_id, info.state)
```
Synchronous indexing and slicing refer to the remaining results without
consuming them. A bounded forward slice such as `jobs[:5]` fetches only enough
pages to reach its stop. `len(jobs)` returns the remaining count by fetching
and caching every remaining result. Negative indexes and open-ended or reverse
slices also fetch and cache all remaining results. These operations can raise
request errors; later iteration drains their cache. `AsyncListing` remains an
async iterator: use `async for` to read it.
`Listing.num_page_results()` reports cached items available without another
request, including items retained by indexing, slicing, or counting.
`Listing.page_token()` reports the next request's token. Drain all cached
items before saving that token, or resuming can skip them. Resume with the same
filters, for example `db.list_jobs(table="events", state="in_progress",
page_token=saved_token, page_limit=5)`. A `None` token after the final page can
coexist with unread cached items. A resumed listing is not a transactionally
frozen view of jobs submitted in the meantime.
`events.schema` describes the Arrow response. Use `events.to_pylist()` for
Python row dictionaries. Common event columns are `event_seq` (int64), `state`
(string), `updated_at_millis` (int64), `updated_by` (string), and nullable
`emitted_from`, `emitted_by` and `claim_entity` strings. Optional uint64 work
counters such as `rows_processed` and diagnostic details depend on job type
and server version. If a `payload` column is returned, its value is a nullable
JSON string, not an already decoded Python dictionary.
Empty results retain their schema. Events are newest first and belong to the
requested job; child events are separate. An event count is not a completed-row
count, and a running job can have no terminal `result` while producing events.
For a Function refresh, `wait()` returns a `RefreshColumnResult` such as
`rows_assigned`, `rows_failed`, `rows_remaining`, `source_version` and optional
`published_version`. Other job types have different results. Do not parse the
printed representation to recover a spec, result or progress measurement.
For object-shaped registry data, `job.spec` and `job.result` are decoded Python
dictionaries: access fields with keys, such as `job.result.get("summary")`
after refreshing a successful Function job. The separate typed object from
`wait()` uses attributes, such as `result.rows_assigned`.
Event responses have [row limits](/basics/limits#jobs). An explicit limit can
request more than the default, but it does not guarantee a complete event
history.
@@ -210,6 +357,36 @@ by the jobs API.
`estimated_remaining_time_millis` is a best-effort client-side estimate. It is
omitted while a job is initializing, queued, or paused, and when there is no
positive progress rate from two compatible samples.
### Inspect a slow Function worker
On a supported Enterprise server, Python's `Job.stack(worker_id)` and
`await AsyncJob.stack(worker_id)` capture Python thread stacks from a running
Function refresh worker. Rust provides `job.stack(worker_id).await?`.
TypeScript does not yet expose this method. Stack inspection requires the
system operate privilege.
Select a worker ID from the job's progress warnings or recorded events. For
example, inspect a worker named in the current no-progress or slow-split warnings:
```python
job = db.open_job(job_id)
snapshot = job.progress() or {}
warnings = snapshot.get("warnings", [])
if warnings:
evidence = job.stack(warnings[0]["worker_id"])
print(evidence["status"], evidence["omitted_sessions"])
for session in evidence["stacks"]:
print(session["status"], session["captured_at_millis"])
print(session["stack"], session["truncated"])
```
`unavailable` and `unsupported` are explicit capture statuses; missing frames
do not establish that a worker is healthy or finished. Captures are bounded and
may reuse a recent sample. They contain Python frames without source text,
locals or native frames. Local operations and SQL-backed query handles do not
support stack inspection. For a worker that already timed out, inspect the
recorded failure events for retained traceback evidence.
*/}
## Embedded and Enterprise execution {#in-process}
@@ -227,45 +404,21 @@ described below.
### SQL-backed job handles
On Enterprise, materialized-view CREATE, REFRESH, and DROP use the SQL query backend.
Python's `create_materialized_view_async()`, `mv.refresh_async()`, and
`drop_materialized_view_async()` return job handles with `status()`, `wait()`,
and `cancel()`. Synchronous creation, refresh, and drop wait on the same SQL
execution before returning. A completed DROP means the catalog binding has been
removed; physical cleanup continues in the background.
On Enterprise, several catalog operations return a job handle backed by the
SQL query engine rather than the job registry:
Remote function registration also returns a SQL query job. The SQL operation
submits the durable image build and waits for catalog publication before returning
the immutable FunctionVersion. `drop_function_async()` returns the catalog-removal
boolean together with a query job; waiting on that handle confirms removal while
physical cleanup continues separately.
| Operation | SDK methods | Behavior |
| --- | --- | --- |
| Materialized views | `create_materialized_view_async()`, `refresh_async()`, `drop_materialized_view_async()` | Synchronous variants wait on the same SQL execution. Drop removes the catalog binding immediately; physical cleanup continues in the background. |
| Functions | Registration, `drop_function_async()` | Registration waits for catalog publication before returning the immutable FunctionVersion. Drop confirms catalog removal while cleanup continues separately. |
| Secrets | Create, alter, list, describe, drop | Credential values are bound as SQL parameters, never embedded in SQL text or returned in results. `DESCRIBE SECRET` additionally exposes rotation history. |
| Views | Create, describe, list, drop | Create returns the stored definition and schema. Drop confirms catalog removal while cleanup continues separately. |
Remote Secret create, alter, list, describe, and drop use the SQL query backend.
The synchronous APIs wait on query completion internally. Create and alter bind
the credential as a parameter to
`CREATE SECRET name TYPE = GENERIC_STRING SECRET_STRING = $1` or
`ALTER SECRET name SET SECRET_STRING = $1`, keeping it out of SQL text. Results contain only
completion status or Secret names and timestamps; they never return credential
values. SQL `DESCRIBE SECRET` additionally exposes rotation history.
Remote view creation, description, listing, and drop also use SQL. Creation
returns the stored definition and schema from the same SQL execution.
`drop_view_async()` returns a query job: waiting confirms catalog removal while
physical cleanup continues in the background.
The existing `job.job_type` identifies query-backed handles as `"query"` from
submission, and `job.id` contains the connection-scoped SQL query UUID string.
Use `describe_query(job.id)` on the submitting connection to inspect the query.
Registry handles retain their server-reported job types (available after
`status()` or `refresh()`) and registry IDs. Local handles have no ID or job type.
SQL-backed handles do not expose registry records or event history and cannot
be reopened through `open_job()` or reattached after a client restart. Their IDs
are not durable resume tokens. Cancellation follows the SQL server's
capabilities and can be unsupported.
The server decides whether SQL executes on its serving fleet or starts SQL job
workers. That placement does not change the handle's query-backed identity.
All of these report `job.job_type` as `"query"`, with `job.id` holding the
connection-scoped SQL query UUID -- use `describe_query(job.id)` to inspect
one. Unlike registry handles, they don't expose event history, can't be
reopened through `open_job()` or reattached after a client restart, and
cancellation depends on the SQL server's support for it.
### Object teardown {#teardown}
+5 -4
View File
@@ -49,9 +49,10 @@ tbl = db.open_table("frames") # opens /data/frames.lance; version=N pins a vers
Use `lancedb` for search, retrieval, data curation, multimodal blob access and
application code. Install `pylance` (`import lance`) only when building query
engines or connectors, calling format-level fragment APIs directly, or
converting plain-scan lazy or legacy blob columns with `to_pandas()` (see
[Multimodal data and blobs](/management/table#multimodal) for `pylance`-free
conversions).
converting plain-scan lazy blob handles with `to_pandas()`. Legacy plain-scan
byte conversions use LanceDB's native path without `pylance` (see
[Multimodal data and blobs](/management/table#multimodal) for conversion
boundaries).
| `pylance` (`import lance`) | `lancedb` (`import lancedb`) |
| --- | --- |
@@ -75,4 +76,4 @@ conversions).
- [Multimodal data and blobs](/management/table#multimodal): declare `lancedb.blob()` columns and read blobs on demand.
- [Table versioning](/management/table#versioning): read and manage table versions.
- [Computed columns](/feature-engineering/add-computed-column): add derived features to your data.
- [Architecture](/index#architecture): how LanceDB Embedded and Enterprise build on Lance.
- [Embedded vs Enterprise](/basics/embedded-vs-enterprise): how LanceDB Embedded and Enterprise build on Lance.
+46
View File
@@ -0,0 +1,46 @@
---
title: "LanceDB Embedded"
sidebarTitle: "LanceDB Embedded"
description: "The open-source, embedded retrieval library that runs inside your application process."
icon: cube
keywords: ["embedded", "open source", "oss", "local", "sdk", "lancedb embedded"]
---
**LanceDB Embedded** is an open-source, embedded retrieval library, with client SDKs in Python, TypeScript and
Rust -- the application itself plans queries, builds indexes, and runs background work, with no separate database
server to deploy. It reads and writes tables on local disk or in object storage from inside your application
process, on the same [Lance](/basics/lance) format and table model that [LanceDB Enterprise](/enterprise/index)
builds on.
<Frame caption="LanceDB Embedded: the LanceDB SDK and the Lance format run in your application, reading and writing tables on local disk or in object storage.">
<img src="/static/assets/images/overview/lancedb-embedded.png" alt="LanceDB Embedded architecture" width="440" />
</Frame>
## Why use LanceDB Embedded? {#why-use-lancedb-embedded}
LanceDB Embedded fits local retrieval applications, notebooks, development, and single-node data pipelines, where
your application controls its own compute resources and [table maintenance](/maintenance/compaction).
- **No infrastructure to run** -- the library runs inside your process. There is no server to deploy, configure,
or keep available.
- **Free and open source** -- `pip install lancedb` (or the TypeScript or Rust equivalent) and start reading and
writing tables, with no account or service to set up first.
- **Full local control** -- your application decides where table data lives, when maintenance such as compaction
and indexing runs, and how much compute each operation gets.
- **The same table format as Enterprise** -- Embedded and [Enterprise](/enterprise/index) share the same Lance
format and table model, so moving to a distributed deployment later does not require a data conversion step.
## Get started {#get-started}
<CardGroup cols={2}>
<Card title="Quickstart" icon="rocket" href="/quickstart">
Create a table, add data, and run your first search in a few lines of code.
</Card>
<Card title="Choose an SDK" icon="code-compare" href="/basics/sdk">
Pick between the Python, TypeScript, and Rust SDKs.
</Card>
</CardGroup>
When your data or traffic outgrows a single machine, or you need managed infrastructure, private deployment, or
platform support, see [LanceDB Enterprise](/enterprise/index) and the
[feature-by-feature comparison](/basics/embedded-vs-enterprise).
+11 -3
View File
@@ -10,7 +10,7 @@ keywords: ["names", "naming", "table name", "namespace", "identifier", "limits"]
<span id="objects" />
Databases, namespaces, tables, views and branches all have names. Choose names
Databases, namespaces, tables and views all have names.{/* Draft until branching reaches early access: restore "Databases, namespaces, tables, views and branches all have names." */} Choose names
that describe their purpose, such as `documents`, `prod` or `training_2026`.
Consistent names make data easier to find and application code easier to read.
@@ -21,10 +21,14 @@ Use the following rules for names that work across LanceDB Embedded and LanceDB
| Table, materialized view, view | ASCII letters and digits, `-`, `_`, `.` | 1 to 128 characters |
| Namespace component | ASCII letters and digits, `-`, `_`, `.` | 1 to 64 characters; at most 10 components in a path |
| Database | ASCII letters and digits, `-`, `_`, `.`, with `/` between components | 1 to 64 characters for the whole name |
| Branch | Avoid `$` and `:`; use ASCII letters, digits, `-` and `_` for portability | Keep to 1 to 64 characters |
| Secret | ASCII letters and digits, `-`, `_`, `.` | 1 to 128 characters |
| Function | ASCII letters and digits, `_` | 1 to 128 characters |
{/*
Draft until branching reaches early access; restore after the Database row.
| Branch | Avoid `$` and `:`; use ASCII letters, digits, `-` and `_` for portability | Keep to 1 to 64 characters |
*/}
- Names and individual namespace or database components must not be empty.
- Table, view, namespace and database components cannot be `.` or `..`.
- Secret names cannot be `.` or `..`.
@@ -60,5 +64,9 @@ The empty path `[]` identifies the root namespace.
## Learn more {#next}
- [Namespaces](/management/namespace): create namespaces and address tables.
- [Branches](/tables/branching): name and manage separate lines of table history.
- [Limits](/basics/limits): check other constraints before designing your schema.
{/*
Draft until branching reaches early access; restore after Namespaces.
- [Branches](/tables/branching): name and manage separate lines of table history.
*/}
+1 -1
View File
@@ -53,7 +53,7 @@ without a LanceDB SDK. For SQL queries, connect through
LanceDB's Java client builds on this Lance Namespace Java core: table creation,
listing and most other catalog operations go through the generated
`LanceNamespace` interface talking to Enterprise's Namespace endpoint.
The [real time engine](/tables/realtime-engine) is the one area with its own,
The [Realtime Engine](/tables/realtime-engine) is the one area with its own,
LanceDB-specific Java client on top, since RTE's LSM write path is not part of
the Lance Namespace Client SDK Specification.

Some files were not shown because too many files have changed in this diff Show More