Files
lancedb/docs/web/ingestion/update.mdx
T
Jack Ye 44f4b959ca docs: restructure the Documentation tab around catalog objects
The tab opened on Quickstart, buried "What is LanceDB?" inside it, and put
everything else under a single Guides group that had to be expanded before any
section was reachable. Model training sat outside it for no reason.

Reorganize around what a user does, in order: Introduction, Catalog, Ingestion,
Search, Feature engineering, Training, Maintenance, SQL. Guides is gone as a
level, so each section is one click.

New pages: catalog overview and database, and a compaction page under
Maintenance. tables/update covered four separate operations, so it becomes the
Ingestion section — insert, merge insert, update, delete — with insert drawing
on the large-dataset material from tables/create. Its old URL redirects.

Agentic skills move to their own tab after API Reference.
2026-09-09 21:33:24 -07:00

79 lines
2.2 KiB
Plaintext

---
title: "Update rows"
sidebarTitle: "Update"
description: "Change values in rows that already exist, by predicate or SQL expression."
icon: pen
---
These examples use the table set up in
[Ingesting data](/ingestion), and the connection made there.
import {
PyUpdateOperation as UpdateOperation,
PyUpdateUsingSql as UpdateUsingSql,
TsUpdateOperation,
TsUpdateUsingSql,
RsUpdateOperation,
RsUpdateUsingSql,
} from '/snippets/tables.mdx';
## Update rows {#update-rows}
Use `update` when you already know which target rows to modify and you do not need to compare against an incoming dataset.
<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>
Expected table contents:
| id | name | login_count |
| --- | --- | --- |
| 1 | Alice | 10 |
| 2 | Bobby | 20 |
<Warning title="Warning">
Updating nested columns is not yet supported.
</Warning>
## Update rows with SQL expressions {#update-rows-with-sql-expressions}
Use `values_sql` when you want to use SQL-like expressions to update rows. This is useful for operations like incrementing a counter, or setting a column value based on another column.
<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>
Expected table contents:
| id | name | login_count |
| --- | --- | --- |
| 1 | Alice | 10 |
| 2 | Bob | 21 |
<Note title="SQL syntax">
See the [SQL queries](/search/sql/) page for more information on the supported SQL syntax.
</Note>
When rows are updated, they are moved out of any existing index. The row will still show up in search queries, but the query will not be as fast as it would be if the row was in the index. If you update a large proportion of rows, consider triggering an index rebuild afterwards.