## Summary
Supersedes #2330 and brings the Mastra integration guide onto the
current `docs/web` Mintlify documentation structure with verified
LanceDB Embedded examples against the published `@mastra/lance` release.
Credit to @vishesh-baghel for authoring the original LanceDB Mastra
guide in #2330 and building the merged upstream Mastra storage and
vector adapters in mastra-ai/mastra#3324.
### Changes
- Add `docs/web/integrations/ai/mastra.mdx` covering LanceDB Embedded
usage with `@mastra/lance`:
- Node.js 22.13.0+ requirement and `npm install @mastra/lance
@mastra/core`.
- Runnable local `LanceVectorStore` quickstart (`create`, `createIndex`,
`upsert`, `query`, `close`) with verified nearest-neighbor output
(`lancedb 1`).
- Explanation of the two-step native vector index behavior in
`@mastra/lance` (first `createIndex()` initializes an empty table;
calling `createIndex()` again after upserting at least 256 rows builds
the native index on the `vector` column).
- Pointer to `LanceStorage` noting the published three-argument
`LanceStorage.create(id, name, uri)` signature and linking upstream
Mastra references, without unverified cloud claims.
- Register `integrations/ai/mastra` under **AI Platforms & Frameworks**
in `docs/web/docs.json`.
- Add the TypeScript example snippets to
`docs/web-tests/ts/integrations.ts` and regenerate the corresponding
exports (`TsFrameworksMastraQuickstart`,
`TsFrameworksMastraNativeIndex`) in
`docs/web/snippets/integrations.mdx`.
## Verification
- Verified against published `@mastra/lance@1.6.1` and
`@mastra/core@1.85.0` (resolving `@lancedb/lancedb@0.31.0` and
`apache-arrow@18.1.0`):
- Two-vector local quickstart returns `lancedb 1`.
- Native `IVF_FLAT` index build after upserting 256 rows reports
`vector_idx` with 256 indexed rows, 0 unindexed rows, and
nearest-neighbor score `1`.
- Confirmed `LanceStorage.create(id, name, uri)` succeeds with three
arguments while the older two-argument call fails.
Add `azure_storage_account_access_key_secret` to the sync and async
Python storage integration APIs, with a matching Rust constructor. The
SDK sends a Secret reference in SQL and decodes the reference returned
by CREATE and DESCRIBE.
```python
info = db.create_storage_integration(
"blobs", "az://customer-data/raw/",
storage_provider="AZURE",
azure_storage_account="customeraccount",
azure_storage_account_access_key_secret="azure_key",
)
```
Azure requires a storage account and one authentication mode. The
account access key uses a single Secret. Service principal
authentication uses the existing three Secret references.
BREAKING CHANGE: Rust callers constructing
`lancedb::function::FunctionOutput` with a struct literal now supply
`blob_writer_paths`. Use `Vec::new()` for an output without
writer-capable fields.
LanceDB Functions that generate large Blob v2 values can declare their
output with `BlobWriter` and write chunks during a computed column
refresh in a compatible LanceDB Enterprise environment. Row-wise and
vectorized callables use the same logical Blob schema. Named and nested
outputs can mark specific leaves with `BlobWriter.field` while retaining
ordinary binary siblings and nullable fields.
The SDK preserves writer requirements through native registration and
computed column binding. A distinct output kind lets earlier Enterprise
versions reject registrations that require a writer. Existing bytes-only
registrations retain their wire format and adapter.
On SDK commit
[`a19e7b87`](https://github.com/lancedb/lancedb/commit/a19e7b873c36aec865f092a368760be8846233ed),
a rebuilt extension preserved nested writer paths through Flight SQL
registration and version readback. Enterprise 1.14.1 rejected the writer
registration before building the Function image. With the compatible
runtime candidate, a real Flight SQL refresh published a 2 GiB + 137
byte value in each Blob layout against Moto. Independent reads verified
length and SHA-256 before and after cleanup of an older version. The run
also confirmed multipart abort and cumulative descriptor accounting.
[Runtime
evidence](https://linear.app/lancedb/issue/ENT-4209#comment-26e69e0e-faad-4aac-b148-3f4591181182)
· [Descriptor
accounting](https://linear.app/lancedb/issue/ENT-4209#comment-4d05e27a-8ff2-4003-804a-8af2f29ce2f4)
This SDK change is part of the coordinated Enterprise delivery.
[ENT-4209](https://linear.app/lancedb/issue/ENT-4209)
Dropping a column can leave its data in files that the current table
still needs. The schema guide now explains how compaction and retention
determine when cleanup can reclaim those data files and their ordinary
Blob v2 sidecars.
Eight Python examples on the consistency, insert and merge-insert pages
are presented as complete programs, but the published snippets started
after the imports, temporary directory and connection, so they failed
with NameError when run on their own.
The snippet start markers had been moved below the setup in the test
files. This moves them back above it and regenerates the snippets.
An Enterprise Function refresh can spend time waiting for execution
workers. Applications polling `job.status()` currently see `running`
during that wait. Return `waiting_for_capacity` when the server reports
that phase for an active Function refresh. The next status request
reports `running` when execution resumes. Applications can use
`job.wait()` to wait through both states until completion.
Rust, Python and Node read the phase from the existing job description
response.
## Validation
Two HTTP regression tests exercise the public job handle. They cover the
wait, work resuming, completion after another wait, a stale phase at
completion, queued and paused refreshes, other job types, and servers
that omit the phase. The Rust CI remote job runs these tests.
LanceDB Enterprise users can resume a failed Function refresh from its
table with `table.resume_refresh(job_id)`. The synchronous and
asynchronous Python APIs return a typed job handle. Waiting on that
handle uses the same table freshness tracking as a newly submitted
refresh.
The request carries the current table identifier and branch to the
server. The server decides whether the original attempt can be resumed
and supplies the reason when it cannot. The Python refresh methods also
accept a positive `max_job_attempts` option for automatic recovery.
These features require server support for Function refresh recovery.
The PR adds remote request, branch, error propagation, and typed result
tests. Python and Rust validation runs in PR CI.
BREAKING CHANGE: Resource inputs use the same names at Function
registration, column/MV creation, and refresh. Use total_cpu_millis,
total_memory_bytes, and total_gpu_count for execution-wide worker
budgets, plus gpu_class and positive gpu_count for each worker. Replace
budget dictionary inputs and unprefixed aggregate limits with these
fields. Move existing refresh gpu_count caps to total_gpu_count;
gpu_count now selects devices per worker.
Each setting resolves independently: refresh > column/MV creation >
Function annotation > deployment. Creation settings also apply to
initial MV population and automatic refresh. MVs sum total budgets
across distinct pinned Function versions; per-worker GPU counts use the
largest Function default unless overridden. An unset GPU class resolves
to gpu_class="any" after inheritance; an explicit "any" overrides a
registered concrete class. Use gpu_class="default" to pin the default
pool explicitly.
```python
@function(
gpu=True, gpu_class="h100", gpu_count=2,
total_cpu_millis=8000,
total_memory_bytes=16 * 1024**3,
total_gpu_count=4,
)
def embed(text: str) -> list[float]: ...
version = db.create_function(embed)
table.add_columns(
{"embedding": version(text=col("text"))},
gpu_class="any", gpu_count=1, total_gpu_count=8,
)
table.refresh_column_async(
"embedding", gpu_class="h100", gpu_count=4, total_gpu_count=8,
)
mv = db.create_materialized_view(
"embeddings", query="SELECT embed(text) AS embedding FROM documents",
gpu_class="any", gpu_count=2, total_gpu_count=8,
)
mv.refresh(gpu_count=4, total_gpu_count=8)
```
```mermaid
flowchart TD
R["Refresh settings"] --> E["Effective settings, resolved per field"]
D["Column or MV creation settings"] --> E
F["Function settings"] --> E
C["Deployment defaults"] --> E
E --> W["GPU class and device count per worker"]
E --> T["Total CPU, memory and GPU ceilings"]
```
Pinned Function images retain their identity. Registration GPU counts
are defaults; execution overrides determine worker allocation. Admission
rejects GPU counts below an image's minimum requirement or above the
total budget. Python, Rust, SQL/REST and supported TypeScript operations
use the same resource model.
No local builds or tests, as requested; regression coverage runs in CI.
Installing the CLI from the guide previously required a repository
checkout or a manual download. The installer is available directly from
the downloads site. This updates the guide and quickstart for the
v0.42.0 stable release.
## Summary
Clarify in the persistence guide and `persist` docstring that only the
plan destination must be Embedded. The base table can be Embedded or
Enterprise; an Enterprise base is pinned through the plan's recorded
base branch/version.
Add a focused loopback regression that persists a plan from a mock
remote base into an Embedded database, reopens the plan by destination
with `db.open_table`, advances the mock base's latest version to v2, and
verifies a fresh remote handle observes v2 while `Permutation` still
reads the plan's recorded main/v1 coordinates. Sequential iteration and
duplicate/unsorted offsets follow the stored plan order, and the mock
records nonempty v1 scan/gather requests.
## Verification
- Focused test plus affected remote mock tests: 3 passed.
- `ruff format --check` and `ruff check` passed.
- `git diff --check` passed.
This is a docs/test-only follow-up. It does not add Enterprise-resident
plan persistence or change plan ordering.
Expose affected columns, pinned Function name/version, completion time,
duration and failure summaries on `JobInfo` in the Rust, Python and
TypeScript SDKs. Values come from the listing response, so callers can
inspect recent computed column refreshes without opening every job.
Older servers keep optional values absent; measured zero durations stay
zero.
```python
latest = next((info for info in db.list_jobs(table="events", job_type="function_refresh") if "embedding" in info.columns), None)
if latest is not None:
print(latest.function_name, latest.function_version, latest.duration_millis)
if latest.failure is not None:
print(latest.failure.message)
```
Duration is creation-to-completion wall time, including queueing and
pauses. Adds listing response coverage across SDKs and documents the
metadata contract, including SQL `SHOW JOBS EXTENDED` for the expanded
listing. Plain `SHOW JOBS` preserves its original columns. Local builds
and tests were skipped as requested.
The dependency advisory check also fails on current main because
`libsais-rs 0.2.0` is yanked ([main
job](https://github.com/lancedb/lancedb/actions/runs/44470513618/job/135378545456));
this PR does not change dependencies.
This changes the public shape of Rust and TypeScript `JobInfo`: callers
constructing summaries must supply the added fields (including
TypeScript `columns`). TypeScript table filtering remains a separate
concern; the guide now shows its client-side selection and namespace
limitation alongside Python and Rust server-side filters.
Refs ENT-3903.
Adds the Embedded `Table.delta` API to the Node.js bindings, matching
the Rust/Python contract from #5135. `Table.delta(fromVersion,
toVersion?)` accepts a positive safe-integer number, a positive lossless
u64 `bigint`, or a same-branch tag string. `TableDelta` exposes
`beginVersion`/`endVersion` as `bigint`, streaming `insertedRows()`,
`updatedRows()`, `upsertedRows()`, `deletedRowIds()`, and
`listTransactions()` with `readVersion` as `bigint`.
Readers reuse the existing native Arrow IPC iterator adapter. They are
lazy, single-use, serialize pulls, capture/cache the schema before
polling, and release the native stream on completion, break, or error.
Row readers retain the Rust contract: equal endpoints return empty
streams with schemas, invalid/reversed/missing endpoints and
cross-branch tags are rejected, and Restore or incomplete transaction
history fail closed with full-rescan and range-end checkpoint guidance.
Enterprise tables remain unsupported through the native Rust default.
The abstract `Table` keeps a concrete unsupported `delta` default for
custom subclasses; `LocalTable` overrides it. TypeDoc API docs and
focused Node tests cover pinned targets, typed bigint values,
transaction listing, lazy rejected readers, schema/decode failures,
aliasing, and early drop.
Refs OSS-2860
BREAKING CHANGE: JobDescription, JobEventsRequest, FunctionErrorsRequest, and FunctionErrors gain optional Rust metadata/cursor fields. Existing struct literals must initialize them; use None when unavailable.
Preserve typed attempt state, pinned retry lineage, result decoders and freshness fences, and retained diagnostic paging across SDKs. Keep Python job data access method-only.
Make all Python `Job` and `AsyncJob` data access method-only. Cached
property accessors are private and underscore-prefixed; public reads use
`id()`, `state()`, `job_type()`, `creation_ms()`, `spec()`, `result()`
and `failure()`. `checkout_latest()` refreshes the complete cached
registry record in place and returns `None`.
```python
job.checkout_latest()
print(job.state(), job.result(), job.failure())
print(job.id(), job.job_type(), job.creation_ms(), job.spec())
```
Cached read methods are synchronous on both handle types. Async handles
use `await job.checkout_latest()` for the live refresh; event history
remains a separate request through `events()`. Update Python SDK
callers, tests and guides to use method calls, including
progress/timeout handling and bounded repr. Cover method-only visibility
and holistic snapshot freshness through both sync and async clients.
BREAKING CHANGE: Python job data access now requires method calls, such
as `job.state()` instead of `job.state`. No property compatibility
aliases remain.
Fixes
https://linear.app/lancedb/issue/ENT-3902/sdk-make-cached-versus-live-job-accessors-unambiguous
`lancedb.udf` is a deprecated alias of `lancedb.function` and emits a
`DeprecationWarning`. This switches the quickstart and the curation
examples to `function`, so readers who copy them no longer see the
warning. The quickstart snippet is regenerated from its test.
Node.js did not provide parity with the Python tag fixes in #5136.
`tags.create()` required an explicit version, and `branches.create()`
could not fork from a tag without resolving a numeric version that loses
the tag's branch identity.
This adds Node.js parity:
- `tags.create(tag, version?)` defaults an omitted version to the
version visible to the table handle, including checked-out and
time-travel handles. Explicit versions are unchanged.
- `branches.create(name, { fromTag })` forks through `Ref::Tag`,
preserving the tag's branch and version. Existing `create(name,
fromRef?, fromVersion?)` calls are unchanged. Mixing `fromTag` with
another source is rejected before `main` normalization.
- A missing Embedded branch keeps its original error and now includes
the actual `branches.create(..., { fromTag: ... })` call as guidance.
Enterprise 404s keep their original error without guessing from the
message.
- Enterprise uses the existing tag resolution and branch-create wire
contract; no wire changes.
The released web guide remains on the published package examples. The
new API is documented in the TypeScript API reference and source, with
Node regression coverage.
Adds native `Table::delta(from_version, to_version=None)` and Python
sync/async `table.delta(...)` for version-to-version row changes.
`TableDelta` exposes streaming `inserted_rows()`, `updated_rows()`,
`upserted_rows()`, `deleted_row_ids()`, and `list_transactions()`.
Endpoints are resolved once on independent dataset handles.
`to_version=None` uses the table handle's visible snapshot, and the
handle's checkout is not changed. Only versions `>= 1` and tags on the
current branch are accepted; cross-branch tags, reversed ranges, version
0, and missing endpoints are rejected. Equal valid endpoints return
empty readers with the same schemas.
Row-level readers require stable row ids at both endpoints and report
the `storage_options={"new_table_enable_stable_row_ids": "true"}`
creation guidance when they are absent. `list_transactions()` does not
require stable row ids.
Row-level readers also fail closed when the range contains a `Restore`,
or when transaction history cannot prove the range is restore-free,
because restored rows can retain older row-version metadata that the
delta readers omit. The error directs consumers to a full rescan and
reinitializing the checkpoint at the range end version.
`list_transactions()` remains available for readable history. The
Versioning guide includes Python and Rust checkpoint-delta examples with
stable-row-ID setup and this Embedded limitation.
Embedded `branches.diff()` remains a separate API.
Refs OSS-2860
LanceDB SDK users connected to Enterprise had no explicit API to submit
durable cleanup or preview its work; Python's existing cleanup helper
remained a warning-only no-op. This PR adds the SDK support for
[ENT-2687](https://linear.app/lancedb/issue/ENT-2687) through public SQL
and Job APIs. It requires a compatible Enterprise release supporting
`VACUUM`, JSON preview and result format version 1. Existing
cleanup/optimize helpers retain their behavior; the new APIs reject
Embedded and historical-version handles.
This was accomplished with the following changes:
- Add `cleanup_async()` / `cleanupAsync()` and `explain_cleanup()` /
`explainCleanup()` in Python sync/async, TypeScript and Rust.
- Preserve the handle's namespace/branch and resolve retention as
invocation → table/branch TTL → deployment default. Omission inherits,
zero is explicit, and malformed options fail rather than being
discarded.
- Require one nonempty durable SQL receipt, preserving diagnostics
without REST fallback, query-ID substitution or automatic resubmission
after ambiguous acceptance.
- Add versioned `CleanupPlan` estimates and `CleanupResult`
measurements. Preview creates no cleanup job or reservation; results
preserve known zero, unknown retry/recovery totals and nonfatal failed
deletes, excluding auxiliary sweeps.
- Retain typed results on reopening and reuse shared
status/progress/events/wait/cancel APIs. Timeout leaves work running;
cancellation cannot undo deletion or prove storage I/O stopped.
- Document Ownership/parent Usage and required coordination at every
retention value: disable/drain automatic cleanup and prevent competing
cleanup, tag creation/update, branch creation and restore across all
clients until completion. The server does not enforce exclusion;
concurrent restore can leave the current table unreadable.
- Update Python's legacy no-op warning and the maintenance, Python, Rust
and generated TypeScript references.
| Interface | Submit with seven-day retention |
| --- | --- |
| SQL | `VACUUM events WITH (min_age_seconds = 604800);` |
| CLI | `lancedb admin table cleanup --table events --min-age-seconds
604800 --wait` |
| Python | `job = table.cleanup_async(min_age_seconds=604800)` (use
`await` with AsyncTable) |
| TypeScript | `const job = await table.cleanupAsync({ minAgeSeconds:
604800 });` |
| Rust | `let job =
table.cleanup_async(CleanupOptions::new().min_age_seconds(604800)).await?;`
|
### Testing
Added submission/preview, validation, typed-result and reopening tests,
and updated the legacy no-op warning assertion. Focused Python
cleanup/Job and compaction/prewarm regressions passed, alongside **34
TypeScript** and **46 Rust** tests. **31 end-to-end scenarios** passed
against a real Enterprise server, covering CLI/SQL/REST/SDK submission,
retention precedence, restart/reopening, timeouts, cancellation and
branch/namespace isolation.
Local native SDK validation used a separate `libsais-rs 0.2.0` lockfile
because the registry could not resolve `0.2.4`; this PR retains main's
dependency pins and lockfile.
## Summary
Add `permutation_builder(base).persist(db, table_name, *,
namespace_path=None, mode="create").execute()` for embedded local and
object-store destinations. The native create request carries the
namespace and create/overwrite mode, with no drop-before-create. The
returned table keeps the destination connection context so it can be
pickled and reopened directly, including namespaced and manifest-enabled
connections.
Persisted plans pickle by reference to their own branch and version, so
a later overwrite or cross-branch checkout does not change what an
existing pickle reads. In-memory plans, old serialized state, and
shallow copies keep their existing behavior. `Permutation.base_version`
and `base_branch` expose the recorded base snapshot from loaded
metadata. Enterprise destinations remain rejected in v1 because
reproducible remote plan ordering is follow-up work.
## Verification
- `test_permutation.py`: 93 passed.
- `test_torch.py`: 23 passed in a compatible torch 2.15 / NumPy 2.2 /
PyArrow 26 environment using the abi3 extension.
- S3 direct-result persistence/pickle test passed against a disposable
loopback Moto server using the existing fixture's fake keys and explicit
storage options.
- Earlier targeted checks predate the live snapshot pin repair: Rust
builder tests 12 passed; Rust check/clippy and Node type-check passed.
- The live snapshot pin repair added private PyO3 glue and was verified
with a rebuilt extension: `test_permutation.py` 93 passed,
`test_torch.py` 23 passed, and one loopback S3 direct-result test
passed.
- `ruff format --check`, `ruff check`, `pyright`, `git diff --check`:
passed.
Enterprise GPU Functions on 1.13.0 through 1.14.1 and on 1.15.0 builds
before the shared 300-second default was restored reject a refresh
without an explicit positive `row_timeout_seconds`.
The GPU authoring example and the `@function`/`@udf` docstrings now
carry the requirement, the definition/request precedence, and sizing
guidance. The 600-second value is a working example from the reported
workload, not a recommendation.
Python `tags.create()` now defaults `version` to the handle's currently
visible version, including checked-out handles. Existing `from_ref` /
`from_version` branch selection and explicit tag versions keep their
current behavior.
`branches.create()` gains keyword-only `from_tag`, so a branch can fork
from a tag through the existing `Ref::Tag` path. This preserves the
tag's actual branch snapshot; resolving only its numeric version could
fork from `main` when both branches share a version number. `from_tag`
conflicts with `from_ref` / `from_version` are rejected before
`from_ref="main"` normalization.
When `from_ref` names a tag instead of a branch, the native
missing-branch failure keeps its classification and receives a static
`from_tag=` hint without another lookup. A missing version and an
ambiguous Enterprise 404 keep their original errors.
The Python sync and async APIs, PyO3 binding, stubs and docstrings are
updated together, with native Rust coverage for a tag on a branch that
shares main's numeric version. Node.js `fromTag` and optional `version`
will follow in a separate PR after this one.
Several Function pages still said a refresh defaults to `error_policy =
'fail'` and that `skip` writes null outputs. The server now defaults new
refreshes to skip with a 5% failed-row ceiling, and skip keeps a row's
existing output, leaving only never-filled rows empty. This updates
those pages to match.
## Summary
Add an opt-in `preserve_order` flag to sync and async `take_offsets`. It
exposes the existing Rust `TakeRestoreExec` ordering path and carries
the flag through `QueryRequest`, `PyQueryRequest`, and the Python
`Query` model.
## Behavior
- Default `preserve_order=False` keeps the existing incremental,
unspecified-order behavior.
- `preserve_order=True` returns found rows in input order, including
repeated offsets.
- Missing non-negative offsets keep filter semantics and are omitted;
negative offsets remain rejected by the existing `u64` contract.
- Rust take queries apply `limit`/`offset` after order and repetition
are restored. Python take builders and Query conversion do not expose
pagination.
- An explicit `order_by` conflicts with offset `preserve_order` and
raises clearly. `take_row_ids` keeps its existing implicit ordering and
explicit-sort behavior.
- `__getitems__` is unchanged: it keeps its Python re-alignment and
strict missing-offset (`ArrowIndexError`) behavior.
## Remote lookup
The remote lookup sends only the deduplicated `_rowoffset IN (...)`
filter and restores order/repetition client-side; there is no new wire
field or backend extension. Namespace take queries stay on local
execution, and RTE/LSM rejects the `_rowoffset` lookup loudly.
## Testing
- Old reviewed head reproduced the serialization regression:
`test_query_serialization_sync/async` failed because the Query model
exposed `False` for an unset field.
- Fixed by using `Optional[bool] = None` and mapping Rust `false` to
absent in `PyQueryRequest`; explicit `True` still survives the actual
round trip.
- `python/tests/test_query.py`: 253 passed, 1 skipped.
- Rust preserve-order tests: 3 passed; row-id/order-by tests: 27 passed.
- Remote ordered Blob bytes, remote permutation, and Blob mode focused
cases: 3 passed.
- `cargo fmt --check`, `ruff format/check`, `py_compile`, and `git diff
--check` passed.
## Migration
`lancedb::query::QueryRequest` is a public non-`#[non_exhaustive]`
struct. Downstream code that constructs it with an exhaustive struct
literal must add `preserve_order: false` or use `..Default::default()`.
The field is client-side metadata and is not sent over the remote
protocol.
Seekable Blob APIs, rollout, and ENT-4059 remain separate work.
Refs OSS-2881 (non-closing).
BREAKING CHANGE: `Permutation.with_format("torch_row")` now uses PyTorch
dtype promotion instead of NumPy promotion. Mixed numeric columns can
change dtype, for example int64 and float32 now produce float32 instead
of float64. Cast columns before formatting when the old dtype matters.
Nullable scalar integer and floating columns still produce NaN; nulls in
nested fixed-size-list or tensor columns, and in bfloat16 columns, are
rejected.
## Problem
`Permutation.with_format("torch")`, `"torch_col"`, and `"torch_row"`
fail when the selected columns include a vector (`FixedSizeList`)
column, which is the column training workloads need. The conversion also
has to preserve Arrow slice offsets, logical `FixedShapeTensor` axes,
and visible nested nulls instead of flattening over them.
## Behavior
- Add `with_format("torch_dict")`: a dict of per-column `(B, *S)`
tensors, usable directly with a `DataLoader` identity collate. Tensors
share Arrow storage where the layout allows.
- Extend `torch` per-row dicts to nested `FixedSizeList` and
`FixedShapeTensor`; PyTorch's default collate stacks them back into `(B,
*S)` tensors.
- Preserve `torch_col` as `(C, B, *S)`, including a zero-copy
`unsqueeze(0)` view for one column.
- Preserve `torch_row` as per-row `(C, *S)` tensors, including `(1,)`
for one scalar column, with `torch.promote_types` for mixed numeric
dtypes. Nullable scalar integer and floating columns keep their previous
NaN behavior; nested fixed-size-list and tensor nulls are rejected.
- `torch_col` and `torch_row` reject heterogeneous sample shapes with
the field names, shapes, and guidance to `torch_dict`.
- Support nested fixed-size lists, `FixedShapeTensor` logical axis
permutations, boolean/integer/floating leaves, empty batches, and
nonzero slice offsets. `torch_dict`, `torch`, and `torch_col` reject
visible nulls.
- NumPy still returns one ndarray. Its pandas conversion may copy, may
promote mixed numeric columns to a common numeric dtype (for example
int64 and float32 to float64), and produces an object array for nested
or incompatible columns.
- `lance.bfloat16` is accepted only for a `FixedSizeBinary(2)` leaf
carrying the `ARROW:extension:name` metadata; offsets/length and byte
order are handled before viewing as `torch.bfloat16`. Unmarked binary
columns are rejected.
This is Python-only and does not change persistence, pickling, or public
method signatures.
## Validation
- `pyarrow 26.0.1`, `torch 2.15.0+cu132`, Python 3.12: `test_torch.py`
23 passed; `test_permutation.py` 84 passed.
- Minimum `pyarrow 16.0.0`, `torch 2.0.1+cpu`, Python 3.11: the nullable
scalar, mixed-dtype, null-rejection, and NumPy tests passed (4 focused
tests). The new NumPy test skips without pandas via
`pytest.importorskip`.
- The pre-existing fork DataLoader tests are flaky only when the full
`test_torch.py` file runs on the minimum stack; each passes when run
alone. Their failure is on the default Python format path and does not
exercise the changed format conversions.
- `ruff format`, `ruff check`, and `git diff --check` pass.
`CONTRIBUTING.md` and the Vale rules link to `lancedb/docs`, which is
private, so outside contributors get a 404. Fixes#5070.
This copies the style guide to `docs/STYLE.md` and points the links at
it. The text is the same apart from the intro, which now describes the
scope from this repository's side, and the internal-names bullet, which
no longer lists the names.
The other three links in `CONTRIBUTING.md` went to the docs repository's
README. The draft-section example is now inline. The combined preview
and saved-edition corrections need the private repositories, so the
guide says to ask a maintainer in the pull request instead.
Replaces #5091.
## Summary
- Preserve the query snapshot carried by a remote query result when
`fetch_blobs` or `fetch_blob_files` receives that result table, instead
of reading row IDs from the table's current snapshot.
- Send the expected `x-lancedb-query-snapshot` on the descriptor take
used by `fetch_blob_files` and verify the response echo before decoding
any descriptor. NULL and empty descriptors cannot escape unverified.
- Point missing `_rowid` and missing row-id errors at
`take_offsets(offsets, with_row_id=True)` for callers that have row
positions, while keeping the existing missing/deleted row-id details.
- Keep `fetch_blobs` row-ID based. Positional access and seekable
video/DataLoader handle design remain separate work aligned with
ENT-4059; this PR does not add `offsets=` or change that contract.
- Document the behavior and keep empty row-id requests at zero I/O.
## Compatibility
Server 0.5.0 is the basic remote Blob API floor. Snapshot-bound
descriptor reads need the actual query identity echo from the serving
node (Sophon #10211, present in tag v1.13.0). If identity cannot be
verified, `fetch_blob_files` fails explicitly instead of accepting
descriptors. Metadata-free row-id input keeps the existing
current-snapshot behavior. This does not claim production rollout or
real server testing.
## Testing
- `python/tests/test_blob.py`: 249 passed, 1 skipped
- `python/tests/test_remote_db.py -k blob`: 133 passed
- Rust remote blob-file unit tests: 13 passed
- `cargo check --features remote --tests --examples`
- `cargo fmt --all --check`, `ruff format` and `ruff check`
Refs OSS-2881 (non-closing).
## Summary
`create_table` / `create_empty_table` now accept registered storage
bases and the embedded opt-in for blob URIs outside them. A create with
data registers `initial_bases` in the same commit, so external Blob v2
references no longer need an empty create followed by `add`.
- Rust `CreateTableBuilder::initial_bases` /
`allow_external_blob_outside_bases`, with `BasePath` re-exported.
- PyO3 and Python sync/async create paths accept lightweight `BasePath`,
dicts, and duck-typed `lance.DatasetBasePath`; `id=None` lets Lance
assign an ID and explicit `0` or duplicate explicit IDs are rejected.
- `blob_uri_array` builds the standard four-field `lance.blob.v2` array
without pylance and keeps field metadata such as
`lancedb:logical_type=mp4`.
- Enterprise create rejects non-empty `initial_bases` and the true
opt-in before normalization, input iteration, or HTTP; empty/false
defaults remain an ordinary create.
- Native namespace create merges namespace and connection storage
options into the caller's store parameters instead of replacing them.
This is reconciled with #5114's refresh layering, so caller-scoped
options survive create, refresh, and reopen while namespace-vended
values keep their precedence.
- The outside-base opt-in applies to one write: setting it on create
does not carry over to a later `add()`.
## Validation
- `cargo fmt --all -- --check`, `cargo check --quiet --features remote
--tests --examples`, `cargo clippy --quiet --features remote --tests
--examples`.
- Rust: `blob_integration` 66 passed, `database::namespace` 23,
`connection::create_table` 16, `remote::db` 128.
- Python: `test_blob.py` 263 passed / 1 skipped, `test_blob_array.py` 4,
remote create 12, `test_db.py -k "pickle or create_table"` 15,
`test_namespace.py -k "pickle or refresh or create"` 29, `test_table.py
-k pickle` 8; ruff 0.9.9 and pyright from `python/`.
- `test_blob.py` also passes with pylance and pandas removed (177 passed
/ 87 skipped), matching the CI no-pylance suite. The lightweight and
dict create cases keep version, schema, reopen, and exact-range
assertions there; only the pylance-only manifest introspection moved
into the `DatasetBasePath` case.
- Rust and sync Python two-base probes assert that base 1's scoped
option fails its read while base 2 still returns exact bytes after
reopen. A separate async namespace test covers create and reopen with
exact ranges.
- `test_namespace_refresh_layers_caller_scoped_options` covers the
expired namespace seed: create-time `base_1.caller_scoped` survives
refresh, vended `timeout` is replaced (7s to 8s), fresh namespace values
appear, and reopen with the caller option returns exact blob range bytes
through the registered base.
- Updated `main` through #5127 (including #5114) is merged;
`rust/lancedb/src/database/namespace.rs` and `rust/lancedb/src/table.rs`
match `main`, and no #5114 code was stacked before it merged.
## Dependency note
The Lance dependency stays pinned at the `v15.0.0-beta.25` release on
`main`. With that pin, mixing an automatic base ID (`id=0`) and an
explicit non-zero ID may still collide; the approved upstream fix is
https://github.com/lance-format/lance/pull/11307. Use distinct explicit
non-zero IDs for multi-base creates, or automatic IDs for every base,
until a Lance release containing that fix is pinned. A failed mixed
create can leave the table name listed but unopenable; retrying with
distinct explicit IDs succeeds. Multi-base validation here uses explicit
IDs and bootstrap uses a single automatic ID, so the mixed-ID case is
not claimed as verified until a Lance release containing that fix is
pinned.
## Summary
- Expose `location=` on sync `LanceDBConnection.open_table()`, matching
the existing async entry point while leaving remote and namespace APIs
unchanged.
- When a `ListingDatabase` connection URI ends in `.lance`, append a
parent-directory and table-stem hint to the derived-URI `TableNotFound`
error. The error classification and source chain are preserved, and no
extra storage probes are made.
Context: OSS-2858 remains canceled. This is only the narrow embedded DX
follow-up; it does not add a top-level `lancedb.open_table(uri)` API.
## Verification
- Rust targeted listing tests for the `.lance` hint and the
explicit-location path.
- Python sync `open_table` tests for `location=` and the `.lance` hint.
- Pickle round-trip of a sync `location=` table after #5114.
- `cargo check --features remote --tests --examples`, `cargo fmt
--check`, Ruff format/check.
## Problem
`StreamingDataLoader` left PyTorch's platform default in place for
worker processes, which is `fork` on Linux. Forked workers inherit the
parent process's native runtime and connections, which is the failure
mode behind the fork-isolation work.
## Behavior
When `num_workers > 0` and `multiprocessing_context` is omitted or
`None`, workers now use `forkserver` when the platform provides it,
otherwise `spawn`. Explicit start-method names and context objects are
unchanged. With `num_workers == 0`, no context is selected, preserving
PyTorch's single-process handling. Callbacks and worker state must be
picklable under the selected start method, following PyTorch's
DataLoader rules.
Existing `StreamingDataset` serialization is sufficient for the default
worker path. This does not change the explicit fork opt-in or the native
client reopen path in #3851.
`FunctionDefinition.__call__` ran the decorated Python callable with any
value it was given, so `my_function(value=col("value"))` executed user
code against an `Expr` or silently returned one, with errors such as
`float() argument must be a string or a real number, not 'Expr'`. A
column reference is not a local value: it binds only on a registered
`FunctionVersion`.
An unregistered definition now rejects `Expr` positional and keyword
arguments with `TypeError` before the callable runs, and names the
supported path: `create_function`/`create_function_async`, then
`col(...)` on the returned version. Plain Python and Arrow arguments,
and the class `__init__`/`__call__` lifecycle, are unchanged.
The Function authoring guide's batch example did not register either: a
`pyarrow.Array` annotation carries no element types, so `score_batch`
raised `TypeError` for missing `input_schema` and `output_schema`, and
the page claimed one `pa.RecordBatch` parameter could read several
columns. The example now passes both schemas, shows one `pa.Array`
parameter per input column for multi-column functions, and states that
`input_schema` matches parameters one to one, so a `RecordBatch`
parameter binds one input column. The GPU class example on the same page
had the same missing-schema defect and is fixed too.
Compatibility: code that passed `col(...)` to an unregistered definition
now gets `TypeError` instead of running user code against an `Expr`.
That call was never a supported binding and produced no usable result;
no supported call changes.
## Summary
- Accept column names, `(column_name, "asc"|"desc")` tuples,
`ColumnOrdering`, and `{"column_name": ...}` dicts in both sync and
async `order_by`, including mixed lists.
- Distinguish a bare direction tuple from a list of column names by
container type; `None` and `[]` clear ordering.
- Validate at setter time with actionable errors for unknown dict keys
and invalid directions.
- Export `ColumnOrdering` from `lancedb` and document the accepted forms
with examples.
- Reject non-empty ordering on sync hybrid queries explicitly instead of
silently ignoring it.
Fixes OSS-3108. Namespace pushdown (OSS-3126) is intentionally out of
scope.
## Tests
- `python/tests/test_query.py` (214 passed, 1 skipped)
- `python/tests/test_query.py -k order_by` (7 passed)
- `python/tests/test_fts.py -k order_by` (2 passed)
- `python/tests/test_remote_db.py::test_query_sync_maximal`
- `pytest --doctest-modules python/lancedb/query.py` (21 passed)
- `ruff format` / `ruff check`
## Summary
Adds `__getstate__`/`__setstate__` to native `LanceTable` and
`LanceDBConnection` so a PyTorch `Dataset` that keeps both can cross
`spawn` and `forkserver` worker boundaries. `Permutation` and
`StreamingDataset` now delegate to the same table state representation
while retaining compatibility with older pickle payloads.
## Pickle contract
- Reconnects from the serialized connection and preserves the table
name, namespace path, explicit storage overrides, location, index-cache
setting, managed versioning and pushdown routing.
- Standard mode reopens at latest; `checkout(version)` remains pinned to
the resolved branch/version; branch handles preserve their branch.
Cross-branch tag checkout records the actual live branch.
- `read_consistency_interval=timedelta(0)` remains distinct from `None`.
- `memory://` tables keep the existing Arrow snapshot export/rebuild
behavior.
- `Session` and unreconstructable custom namespace clients fail at
`pickle.dumps` with an explicit `TypeError`; declared namespace
configurations reconstruct, including an omitted properties map.
- Namespace storage options keep caller-only overrides layered over the
live provider, with vended values winning conflicts. Caller options
survive refresh, refreshed credentials replace old vended values, an
explicit provider remains selected on open, and an empty provider
response stays empty rather than restoring an expired seed.
- Declared Python namespace connections reopen through their connection
provider instead of turning the reconstructed client into an explicit
table provider.
## Verification
- Fresh binding build with `uv run --extra tests --extra dev maturin
develop --extras tests,dev`.
- End-to-end `DataLoader` holding `self._db` and `self._table`: spawn
and forkserver passed.
- `test_namespace.py`: 90 passed; `test_table.py` + `test_db.py` +
`test_permutation.py`: 700 passed, 17 skipped.
- Focused namespace provider/pickle regressions: passed, including
caller-only and vended keys after a declared-namespace refresh.
- Rust `test_namespace_connection_with_storage_options` and
`test_manifest_enabled_vend_input_storage_options`: passed.
- `cargo clippy -p lancedb --features remote --tests --examples`, `cargo
fmt --check`, exact CI Pyright (0 errors/0 warnings), and Ruff passed.
- DataLoader Workers documentation updated; Vale reports 0 findings.
## Scope
Does not change the fork hard-error policy, #3851, or direct
`LanceNamespaceDBConnection` pickling. It does not claim changes to the
existing namespace dir `index_cache_size` behavior. This supersedes the
earlier draft #3486, which only moved the table-state portion.
## Summary
The blob v2 TypeScript docs test pinned `@lancedb/lancedb`
`0.41.0-beta.8`, which pulls `@huggingface/transformers` 3.0.2 and
`sharp` 0.33.5. Aikido flags that `sharp` with 2 critical and 1 high
advisory. Bumping to `0.42.0-beta.20` brings transformers 4.3.2 and
`sharp` 0.35.5, matching what the `nodejs` package already ships. The
stable `0.41.0` still uses transformers 3.0.2, so it doesn't fix this.
## Evidence
`npm install --package-lock-only` reports `found 0 vulnerabilities`, and
`npm test` passes 4/4 locally against `0.42.0-beta.20`.
## Merge Risk
**Door:** two-way; only a docs test lockfile changes.
**Blast Radius:** none (docs test only, not run in PR CI).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
## Summary
The `deny` job on main fails because `libsais-rs` 0.2.0, pulled in by
`lance-index`, was yanked from crates.io. This bumps it to 0.2.4 in
`Cargo.lock` and `docs/web-tests/rs/Cargo.lock`. Lockfile-only change.
## Evidence
Before (CI on main):
```text
error[yanked]: detected yanked crate (try `cargo update -p libsais-rs`)
advisories FAILED, bans ok, licenses ok, sources ok
```
After (local, same args as CI):
```text
$ cargo deny --all-features check advisories bans licenses sources
advisories ok, bans ok, licenses ok, sources ok
```
## Merge Risk
**Door:** two-way; lockfile patch bump.
**Blast Radius:** `lance-index` code that builds suffix arrays.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The Quickstart and table guide describe Blob columns as Early access
without naming a product version. Document general availability for
ordinary tables starting with LanceDB Enterprise 1.15.0 and make the
Realtime Engine and MemWAL scope visible in the table guide.
Xuanwo confirmed Enterprise 1.15.0 as the first edition to document GA
for ordinary-table Blob v2. Enterprise 1.13.0 and 1.14.0 retain their
existing status. The Enterprise 1.15.0 edition must carry this wording
when prepared from its release inputs. Earlier saved editions keep their
historical guidance.
Refs ENT-3556.
Part of #4554. Supersedes #4555.
This exposes Lance's R-tree index in the Python and TypeScript SDKs.
Python gets a `lancedb.index.RTree` config with an optional `page_size`,
accepted by `create_index(config=...)` on local, async and remote
tables. TypeScript gets `Index.rtree({ pageSize })` and `RTreeOptions`.
Both map to the Rust crate's existing `Index::RTree`, so remote tables
send `index_type: "RTREE"`. The index accelerates `ST_Intersects`,
`ST_Contains`, `ST_Within`, `ST_Touches`, `ST_Crosses`, `ST_Overlaps`,
`ST_Covers` and `ST_CoveredBy` filters between a GeoArrow column and a
constant geometry, in either argument order, including as a prefilter on
vector search. The scalar index docs page gets an R-tree section.
`geo` is now a default feature of the Python and Node packages. Without
it, a local table can neither build the index nor evaluate `ST_*`
filters, and because wheels and npm packages are prebuilt, an opt-in
Cargo feature would not reach users. pylance already ships with `geo`
on. It adds pure-Rust crates under licenses that `deny.toml` already
allows. `Cargo.lock` doesn't change, and the third-party license notices
are regenerated.
The cost is size: the macOS arm64 release wheel grows from 69.4 MB to
71.7 MB (+2.4 MB, +3.4%).
The tests pin the constant-first predicate bug that held up #4555, which
lance-format/lance#10080 fixed, in queries, `delete()` and `update()`,
with and without the index.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
## Summary
Add a warning triangle for Function Failures and a numbered list for
Catalog listing pagination in the documentation sidebar. Each page gets
one `icon` field in its metadata.
## Verification
Assembled the documentation locally and confirmed both icon fields on
the generated sidebar pages.
Data prewarm methods accept filter expressions but cannot bind their
values, which forces applications to build literal SQL themselves. This
adds optional positional and named parameters to data-prewarm submission
and typed previews across Rust, Python, and TypeScript. Values use the
existing typed Arrow SQL transport and remain separate from the filter
text. Existing calls and job-handle behavior are preserved;
parameterized filters require a compatible LanceDB Enterprise server.
This was accomplished with the following changes:
- Add `PrewarmDataOptions::parameters(RecordBatch)` and forward the
batch through SQL submission and `EXPLAIN PREWARM` requests.
- Reuse Python's `QueryParameters` conversion for
synchronous/asynchronous, legacy/job-returning, and typed preview
methods.
- Add TypeScript positional-array, named-object, and explicit Arrow
parameter inputs, with safe scalar encoding and native IPC forwarding.
- Keep parameter values out of Rust option debug output and reject
invalid input before submission where possible.
- Add transport and codec regression tests, including injection-shaped
strings, typed Arrow values, legacy method forwarding, and typed preview
bindings.
- Document bound filters in the cache-prewarm guide with Python,
TypeScript, and Rust examples; update generic SQL parameter
documentation.
### Usage and behaviour
```python
job = table.prewarm_data_async(
["payload"], filter="id >= $minimum", parameters={"minimum": 1000}
)
job.wait()
```
```typescript
const job = await table.prewarmDataAsync({
columns: ["payload"], filter: "id >= $1", parameters: [1000],
});
await job.wait();
```
Python accepts a sequence, mapping, or one-row Arrow batch/table.
TypeScript accepts scalar arrays/objects or one-row Arrow input; safe
integers and bigint use Int64, fractional numbers use Float64. Rust
accepts a one-row Arrow batch. Parameters bind filter values, while
table identity, branch, and concurrency keep their existing interfaces.
Submission-only methods also forward bindings and retain their existing
return behavior. Typed preview helpers accept the same parameters
without creating a job.
### Testing
Python prewarm Flight transport tests pass (65 cases), Embedded
compatibility tests pass (6 cases), and focused Node parameter/prewarm
tests pass (45 cases, including ten codec and native-boundary cases).
Earlier matching-server verification passed 57 Python/SQL scenarios, 14
Node scenarios, and Rust SDK checks, covering selective and empty plans,
typed values, authorization, pinned branches, legacy methods, and
injection-shaped strings. A bound job also survives a full runtime
restart. The guide submission examples were also verified in Python,
TypeScript, and Rust; the TypeScript example type-checks. Live-server
checks used filesystem storage.
LanceDB SDKs can submit data prewarm jobs, but callers have to issue SQL
directly to inspect a plan before warming. The existing text response
does not provide a typed pruning contract. This adds metadata-only
preview helpers across Rust, Python sync/async, and TypeScript, using a
compatible Enterprise server’s structured SQL response.
This was accomplished with the following changes:
- Add `explain_prewarm_data(PrewarmDataOptions)`, Python
`explain_prewarm_data(...)`, and TypeScript
`explainPrewarmData(options)`.
- Expose `PrewarmDataPlan` and `PrewarmPruningSummary`, preserving zero
versus unknown counts and future pruning-mode strings.
- Reuse submission options, identifier/filter validation, namespace and
branch context, and Azure source-account hint handling.
- Validate the versioned JSON response without parsing display text,
submitting a warming job, polling HTTP job APIs, or falling back to
REST.
- Add API documentation, Flight SQL transport tests, Python sync/async
response tests, and an opt-in live-service integration test.
### Usage and behaviour
```python
plan = table.explain_prewarm_data(["payload"], filter="quality > 0.7")
print(plan.table_version, plan.pruning.selected_fragments)
```
The helper returns a plan directly. It requires table Select plus
database/namespace Usage and a server supporting `EXPLAIN (FORMAT JSON)
PREWARM`. It reads metadata without creating a warming job. Selected
ranges are conservative physical candidates; unknown counts remain
`None`/`null`. A later submission resolves and plans its own snapshot.
Historical-version and Embedded table handles are unsupported.
Add TypeScript `getTableOverrides`, `updateTableOverrides`, and
`resetTableOverrides` for LanceDB Enterprise tables, delegating to the
shared Rust implementation used by Python.
Document that updates perform GET → recursive local merge → full PUT.
Unrelated fields are preserved from the read snapshot, but concurrent
edits can be overwritten. CLI `set` and REST PUT retain replacement
semantics.
Fix an empty SDK update to return the current snapshot without a PUT.
Live testing found that the previous implementation submitted an empty
replacement and failed when no overrides were configured. The fix
applies to Python, Rust, and TypeScript.
Add mock HTTP/local coverage and an opt-in Enterprise integration suite
for namespaces, branch isolation, REST replacement, validation failures,
historical handles, and empty updates.