mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-13 07:12:27 +00:00
Move the public website pages into `docs/web` beside the SDK, with
shared navigation and executable example sources in `docs/web-tests`.
The combined website is assembled by
[lancedb/docs#355](https://github.com/lancedb/docs/pull/355), with six
Enterprise replacements from
[lancedb/sophon#7681](https://github.com/lancedb/sophon/pull/7681).
This includes Function guidance, runnable Quickstarts, regenerated
snippets, production contact/demo fixes, the legacy SQL route, and the
LeRobot redirect. LeRobot remains attributed to Geneva; all 34 Geneva
pages remain in the docs repository until Function officially launches.
Materialized-view guidance follows the full rebuild refresh introduced
by #4373: local refresh writes the complete result, has no `full`
argument, supports `source_version`, and no longer requires stable row
IDs. Deployment SQL refresh options and stable-ID setup are qualified by
version/configuration. Function input guidance distinguishes ordinary
stored columns from computed inputs supported by newer deployments.
**Validation:** independently accepted local checks include 95 Python
tests (real Enterprise excluded), eight TypeScript tests, Rust
Quickstart, snippet parity, typos, deterministic assembly, Mint
validation and links/anchors/redirects. The combined baseline retains
all 181 production routes and 17 legacy redirects. Examples ran locally
against source-built Python SDK 0.40.0b13; existing GitHub workflows do
not run `docs/web-tests`. New main at `069b2f7d` is 0.41.0b0 and adds
computed Function inputs; that SDK was not exercised by the accepted
tests. Latest prose corrections receive focused site validation.
**Merge/rollout:** merge this and #7681 before #355's combined CI, which
reads producer `main`. This is migration infrastructure: section
overlays, source-owned skills and automatic versioned paired releases
remain follow-ups. The current manual publisher is transitional. Hosted
validation, a supported SDK/Enterprise release pair and a real
Enterprise walkthrough remain pending.
Production Mintlify watches `lancedb/docs:deploy-freeze`, directory
`docs`; preserve that source through review. The separate SDK GitHub
Pages reference workflow rebuilds on main merges.
**Updated-head CI (9a50f8db):**
[Typos](https://github.com/lancedb/lancedb/actions/runs/37654185443/job/112904990558),
[PR
title](https://github.com/lancedb/lancedb/actions/runs/37654179507/job/112904974595)
and
[Aikido](https://app.aikido.dev/featurebranch/scan/215386145?groupId=74229)
pass. Critical findings in the example lockfiles were patched: all Sharp
copies use 0.35.5, protobufjs 7.6.6, tar 7.5.22, quinn-proto 0.11.19,
zerovec 0.11.8 and zerovec-derive 0.11.6. The SDK's product dependencies
are unchanged. The revised lockfiles pass eight TypeScript examples,
HuggingFace decode/resize/crop/rescale/normalize plus AVIF roundtrip,
and Rust Quickstart. Aikido passing does not mean every advisory is
cleared; npm still reports 29 high and five moderate advisories in the
example dependency graph. No scanner bypass or suppression was added.
The Function prose correction passes combined/standalone Mint,
deterministic assembly, routes and assets. The revised 325-file site
checksum is
`175bec06864abb400dd292e667ba93448c0479b8359fd7bf6146afabf9040647`. This
PR remains open for independent review; further merges are on hold.
---------
Co-authored-by: Brendan Clement <brendan.clement@lancedb.com>
162 lines
6.6 KiB
Plaintext
162 lines
6.6 KiB
Plaintext
---
|
|
title: Consistency
|
|
sidebarTitle: "Consistency"
|
|
description: Learn about consistency settings and versioning in LanceDB tables.
|
|
icon: "water"
|
|
---
|
|
import {
|
|
PyConsistencyStrong as ConsistencyStrong,
|
|
TsConsistencyStrong as TsConsistencyStrong,
|
|
RsConsistencyStrong as RsConsistencyStrong,
|
|
PyConsistencyEventual as ConsistencyEventual,
|
|
TsConsistencyEventual as TsConsistencyEventual,
|
|
RsConsistencyEventual as RsConsistencyEventual,
|
|
PyConsistencyCheckoutLatest as ConsistencyCheckoutLatest,
|
|
TsConsistencyCheckoutLatest as TsConsistencyCheckoutLatest,
|
|
RsConsistencyCheckoutLatest as RsConsistencyCheckoutLatest,
|
|
RsUpdateMakeUsersReader as RsConsistencyMakeUsersReader,
|
|
} from '/snippets/tables.mdx';
|
|
|
|
You can set `read_consistency_interval` on the connection to control how often reads check for updates from other writers.
|
|
|
|
There are three possible settings for `read_consistency_interval`:
|
|
|
|
1. **Unset (default)**: no automatic cross-process refresh checks.
|
|
2. **Zero seconds**: check for updates on every read (strongest freshness).
|
|
3. **Non-zero interval**: check for updates after the interval elapses (eventual refresh).
|
|
|
|
The value you set depends on your application's consistency needs and performance requirements.
|
|
For example, a real-time dashboard might require strong consistency, while a batch analytics job might be
|
|
fine with eventual consistency. Stronger consistency is not free — the smaller the interval, the more
|
|
often each read pays the cost of refreshing against object storage, which raises per-read latency and cost.
|
|
|
|
This setting works for both local ([LanceTable](/management/database#uris)) and remote
|
|
tables. It only affects read operations —
|
|
write operations are always consistent.
|
|
|
|
<Callout color="blue">
|
|
**Consistency in Remote Tables**
|
|
|
|
For remote tables (`db://` connections), `read_consistency_interval` is also
|
|
respected by the client. The interval is sent to the server as a freshness bound on each read:
|
|
|
|
- **Unset (default)**: no freshness header is sent; reads use the server's cached view of the table.
|
|
- **Zero seconds**: every read asks the server for the latest committed version.
|
|
- **Non-zero interval**: reads accept data at least as fresh as `now - interval`.
|
|
|
|
In addition, after any write or after a `checkout_latest` / `restore` on a table handle, subsequent
|
|
reads on that same handle carry a freshness floor so you read your own writes without extra
|
|
configuration. The floor is the later of the configured interval and the moment of the last
|
|
write or refresh, and it is shared across handles to the same table on the same connection.
|
|
|
|
Each remote table handle also tracks the highest dataset version it has observed in a read
|
|
response and sends it back with every subsequent read, so successive reads on the same handle
|
|
never observe an older version even when a load balancer routes them to query nodes with
|
|
differently-cached views. `checkout_latest` resets this watermark.
|
|
|
|
Stronger consistency is not free — the smaller the interval, the more often each read pays the cost
|
|
of refreshing against storage, which raises per-read latency and cost.
|
|
|
|
In <Badge color="red">Enterprise</Badge> deployments, the server-side default freshness is still
|
|
controlled by the cluster-level `weak_read_consistency_interval_seconds` parameter; the client setting
|
|
tightens that bound on a per-connection basis.
|
|
|
|
<Tip>
|
|
30-60 seconds is a reasonable starting point for
|
|
`weak_read_consistency_interval_seconds`: it cuts unnecessary object-store
|
|
checks while keeping data fresh enough for most applications. This setting
|
|
only affects reads -- writes always remain strongly consistent.
|
|
</Tip>
|
|
</Callout>
|
|
|
|
## Configure Consistency Parameters {#configure-consistency-parameters}
|
|
|
|
To set strong consistency, set the interval to 0:
|
|
|
|
<CodeGroup>
|
|
<CodeBlock filename="Python" language="Python" icon="python">
|
|
{ConsistencyStrong}
|
|
</CodeBlock>
|
|
|
|
<CodeBlock filename="TypeScript" language="TypeScript" icon="square-js">
|
|
{TsConsistencyStrong}
|
|
</CodeBlock>
|
|
|
|
<CodeBlock filename="Rust" language="Rust" icon="rust">
|
|
{RsConsistencyStrong}
|
|
</CodeBlock>
|
|
</CodeGroup>
|
|
|
|
<Expandable title="In the Rust snippets, a `make_users_reader` helper is used to build Arrow input data.">
|
|
<CodeGroup>
|
|
<CodeBlock filename="Rust" language="Rust" icon="rust">
|
|
{RsConsistencyMakeUsersReader}
|
|
</CodeBlock>
|
|
</CodeGroup>
|
|
</Expandable>
|
|
|
|
For eventual consistency, use a non-zero interval:
|
|
|
|
<CodeGroup>
|
|
<CodeBlock filename="Python" language="Python" icon="python">
|
|
{ConsistencyEventual}
|
|
</CodeBlock>
|
|
|
|
<CodeBlock filename="TypeScript" language="TypeScript" icon="square-js">
|
|
{TsConsistencyEventual}
|
|
</CodeBlock>
|
|
|
|
<CodeBlock filename="Rust" language="Rust" icon="rust">
|
|
{RsConsistencyEventual}
|
|
</CodeBlock>
|
|
</CodeGroup>
|
|
|
|
|
|
With the default unset interval, tables do not auto-refresh from other writers.
|
|
To manually check for updates, use `checkout_latest` / `checkoutLatest`:
|
|
|
|
<CodeGroup>
|
|
<CodeBlock filename="Python" language="Python" icon="python">
|
|
{ConsistencyCheckoutLatest}
|
|
</CodeBlock>
|
|
|
|
<CodeBlock filename="TypeScript" language="TypeScript" icon="square-js">
|
|
{TsConsistencyCheckoutLatest}
|
|
</CodeBlock>
|
|
|
|
<CodeBlock filename="Rust" language="Rust" icon="rust">
|
|
{RsConsistencyCheckoutLatest}
|
|
</CodeBlock>
|
|
</CodeGroup>
|
|
|
|
For reproducible reads, you can also pin a table to a specific snapshot with `checkout(...)` or
|
|
a tag, restore a table to a prior version, then return to the live table with
|
|
`checkout_latest` / `checkoutLatest`. See
|
|
[Versioning](/management/table#versioning) for the full version and tag workflow.
|
|
|
|
## Handle bad vectors {#handle-bad-vectors}
|
|
|
|
<Note>
|
|
This section is currently specific to the Python SDK.
|
|
</Note>
|
|
|
|
In LanceDB Python, you can use the `on_bad_vectors` parameter to choose how
|
|
invalid vector values are handled. Invalid vectors are vectors that are not valid
|
|
because:
|
|
|
|
1. They are the wrong dimension
|
|
2. They contain NaN values
|
|
3. They are null but are on a non-nullable field
|
|
|
|
By default, LanceDB will raise an error if it encounters a bad vector. You can
|
|
also choose one of the following options:
|
|
|
|
* `drop`: Ignore rows with bad vectors
|
|
* `fill`: Replace bad values (NaNs) or missing values (too few dimensions) with
|
|
the fill value specified in the `fill_value` parameter. An input like
|
|
`[1.0, NaN, 3.0]` will be replaced with `[1.0, 0.0, 3.0]` if `fill_value=0.0`.
|
|
* `null`: Replace bad vectors with null (only works if the column is nullable).
|
|
A bad vector `[1.0, NaN, 3.0]` will be replaced with `null` if the column is
|
|
nullable. If the vector column is non-nullable, then bad vectors will cause an
|
|
error
|