mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-25 03:53:59 +00:00
A broad documentation pass across the areas LanceDB Enterprise and Embedded diverge on most: **Data Curation** -- GPU Function execution, Slurm scheduling (and what Slurm is, for readers new to it), blob late materialization as its own page, joins, aggregation/profiling, sampling, near-duplicate detection, chunking, distributed shuffle, and IVF-partition clustering. **Feature Engineering** -- computed columns and materialized views, restructured to lead with the Function-based path and show the SQL form side by side with Python throughout; a single Auto Refresh page instead of duplicating scheduling details on every refresh page; adaptive execution; checkpointing; GPU and Slurm placement for refresh workers; a Training Cache page for the PyTorch data loader's automatic cache benefit. **Security & Governance** -- an Audit Log reference (schema, access, grants), Secrets promoted to an ordinary catalog object with their own SQL DDL and a vending/rotation guide, and privilege-table fixes verified against the authorization source. **Deployment & Maintenance** -- Horizontal Scaling and OpenTelemetry moved into a real Deployment area; Automated Cleanup folded into Intelligent Auto-Maintenance (every other maintenance decision already lived there); RTE Compaction and Advanced Conflict Resolution documented in depth. **Landing page** -- the Enterprise feature comparison table reorganized (several redundant or stale rows removed, several new areas added), and the "why Enterprise" bullets replaced with ones tied to a concrete page (Performance, Scale, Fault tolerance, Multicloud deployment, Simplify operations) instead of vague promises. Plus a full pass addressing lancedb-gatekeeper's review: a real test-safety bug (a quickstart test could silently overwrite and delete a deployment's own `frames` table), a fabricated SQL statement with no backing implementation, an actual dedup-guarantee bug in `take_row_ids`, and dozens of documentation-accuracy fixes verified against source rather than taken on faith -- each either fixed, or left with an explicit note on why it needs a feature or deployment owner's sign-off instead of being guessed at. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018PXMCbRH6i5w47TsjeEUMT --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
129 lines
4.9 KiB
Plaintext
129 lines
4.9 KiB
Plaintext
---
|
|
title: "Update rows"
|
|
sidebarTitle: "Update"
|
|
description: "Select existing rows, change values or expressions, and verify the changes."
|
|
icon: pen
|
|
availability:
|
|
embedded: available
|
|
enterprise: available
|
|
---
|
|
|
|
import {
|
|
TsUpdateOperation,
|
|
TsUpdateUsingSql,
|
|
RsUpdateOperation,
|
|
RsUpdateUsingSql,
|
|
} from '/snippets/tables.mdx';
|
|
import {
|
|
PyUpdateOperation as UpdateOperation,
|
|
PyUpdateUsingSql as UpdateUsingSql,
|
|
} from '/snippets/ingestion_examples.mdx';
|
|
|
|
import { PyWriteWorkflow, TsWriteWorkflowBody, TsWriteWorkflowTail, RsWriteWorkflow } from '/snippets/ingestion_examples.mdx';
|
|
|
|
Use `update` to change rows selected by a predicate. Use
|
|
[merge insert](/ingestion/merge-insert) instead when matching an incoming dataset
|
|
against existing keys.
|
|
|
|
## Select the rows to change {#select-rows}
|
|
|
|
Check the predicate with a [filtered query](/search/filtering) before applying
|
|
the update. These examples target the row with `id = 2`. Review the scope
|
|
carefully when omitting a predicate, since that can update the entire table.
|
|
|
|
Each example below starts from Alice with 10 logins and Bob with 20. The
|
|
Python programs create and remove their own temporary database. TypeScript
|
|
and Rust operation blocks use `db`; a complete program is provided below.
|
|
|
|
## Assign a new value {#update-rows}
|
|
|
|
<CodeGroup>
|
|
<CodeBlock filename="Python" language="python" icon="python">
|
|
{UpdateOperation}
|
|
</CodeBlock>
|
|
<CodeBlock filename="TypeScript" language="typescript" icon="square-js">
|
|
{TsUpdateOperation}
|
|
</CodeBlock>
|
|
<CodeBlock filename="Rust" language="rust" icon="rust">
|
|
{RsUpdateOperation}
|
|
</CodeBlock>
|
|
</CodeGroup>
|
|
|
|
The result contains Alice and **Bobby**, with their login counts unchanged.
|
|
The Python `values` and TypeScript `values` arguments take literal values.
|
|
Rust's `column` argument is an expression, so the string value includes SQL quotes.
|
|
|
|
## Calculate a value from the existing row {#update-rows-with-sql-expressions}
|
|
|
|
<CodeGroup>
|
|
<CodeBlock filename="Python" language="python" icon="python">
|
|
{UpdateUsingSql}
|
|
</CodeBlock>
|
|
<CodeBlock filename="TypeScript" language="typescript" icon="square-js">
|
|
{TsUpdateUsingSql}
|
|
</CodeBlock>
|
|
<CodeBlock filename="Rust" language="rust" icon="rust">
|
|
{RsUpdateUsingSql}
|
|
</CodeBlock>
|
|
</CodeGroup>
|
|
|
|
In this separate example, Bob keeps his name and his login count becomes **21**.
|
|
Python's `values_sql` and TypeScript's `valuesSql` accept expressions.
|
|
These SDK expressions work with LanceDB Embedded tables; they do not require an
|
|
Enterprise SQL endpoint. Enterprise also offers [`UPDATE`](/sql/dml/update).
|
|
|
|
## Verify the affected data {#verify}
|
|
|
|
Read the selected rows again and inspect the changed fields. For another
|
|
connection or table handle, account for its
|
|
[read consistency](/tables/consistency) settings.
|
|
|
|
Python's `update` does not compute embeddings. When changing a configured embedding
|
|
source column, provide every associated vector column in the same call. This applies
|
|
to both literal values and SQL expressions, and to synchronous and asynchronous
|
|
tables. Otherwise, the call raises `ValueError` before writing any rows. Use
|
|
[`merge_insert`](/ingestion/merge-insert) with the new source values to generate
|
|
embeddings automatically.
|
|
|
|
Nested-field updates are not supported by these operations. For schema changes,
|
|
see [schema evolution](/management/table#schema). Treat derived values separately:
|
|
changing an input field is not a guarantee that every stored feature has been
|
|
recomputed. See [Refresh a computed column](/feature-engineering/refresh-column).
|
|
|
|
Updates can change index coverage and query cost. After a large update,
|
|
inspect the workload and follow [index maintenance](/indexing/incremental-indexing)
|
|
guidance for the backend you use.
|
|
|
|
## Complete write workflow {#complete-example}
|
|
|
|
<Accordion title="Complete examples: create, append, update, upsert and delete">
|
|
|
|
Each program creates a temporary local database, performs the five operations,
|
|
prints the result, and removes its temporary data when finished.
|
|
|
|
- **Python:** install `lancedb`, save the code as `ingestion.py`, and run
|
|
`python ingestion.py`.
|
|
- **TypeScript:** install `@lancedb/lancedb`, save the code as `ingestion.mts`,
|
|
and run `node ingestion.mts` with Node.js 22.18 or later.
|
|
- **Rust:** download the [complete Rust project](/static/code/ingestion-rust.zip),
|
|
extract it, and run `cargo run --locked`. It includes `src/main.rs`, the Cargo
|
|
manifest and a lockfile for the example's dependencies. The code is shown below.
|
|
|
|
<CodeGroup>
|
|
<CodeBlock filename="ingestion.py" language="python" icon="python">
|
|
{PyWriteWorkflow}
|
|
</CodeBlock>
|
|
<CodeBlock filename="ingestion.mts" language="typescript" icon="square-js">
|
|
{TsWriteWorkflowBody}
|
|
{TsWriteWorkflowTail}
|
|
</CodeBlock>
|
|
<CodeBlock filename="src/main.rs" language="rust" icon="rust">
|
|
{RsWriteWorkflow}
|
|
</CodeBlock>
|
|
</CodeGroup>
|
|
|
|
After the operations, Alice has 10 logins, Bobby has 21, and Charlie has 6.
|
|
Dana is selected for deletion and is absent from the final result.
|
|
|
|
</Accordion>
|