mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-30 15:26:52 +00:00
## Summary Adopts the product terminology guide across the docs site pages, SDK docstrings and error messages. "LanceDB OSS" and local mode become **LanceDB Embedded**. "Remote" as the execution model becomes **LanceDB Distributed**, which LanceDB Enterprise provides. Where free vs paid is the point, pages contrast "LanceDB Embedded (open source)" with "LanceDB Enterprise". This is a first trial of the Embedded name, so reviewers can judge it in context. - **Embedded vs Distributed** for where execution runs (`optimize()`, consistency, branching, maintenance). Main pages define it once: "LanceDB Enterprise runs LanceDB Distributed: …" - **LanceDB Cloud** is kept only for legacy-Cloud specifics (`db://` region, the brute-force KNN limit) and marked legacy. "Cloud and Enterprise" becomes Enterprise or Distributed. - **Plan executor** becomes "executor" or the fleet name. - **Error messages** change, e.g. `optimize is not supported for remote tables.` → `... in LanceDB Distributed.` Tests that match on them are updated. - **Vale rules** (`EmbeddedName`, `OSSProduct`, `RemoteExecution`, `DistributedEnterprise`, `LegacyCloud`, `InternalNames`) enforce the terms in prose. Unchanged: identifiers (`availability.oss`, the `remote` module and feature, `RemoteTable`, `db://`), heading anchors, internal code comments, and Geneva. ## Evidence - Rust lib tests for the changed messages and the Python tests in `test_remote_db.py`, `test_materialized_views.py` and `test_table.py` pass locally. - Not run locally: - The Node tests: `remote.test.ts` and `table.test.ts` have updated assertions. - Vale. - The `experimental_functions`-marked materialized-view tests. - `docs/src` API reference was hand-edited to match the docstrings rather than regenerated. ## Merge Risk **Door:** two-way; prose and message text only. **Blast Radius:** `docs`, `error-messages`: callers matching on old error strings would break. Companion PRs: lancedb/docs (assembler labels, STYLE.md) and sophon (Enterprise pages). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
111 lines
4.5 KiB
Plaintext
111 lines
4.5 KiB
Plaintext
---
|
|
title: "Delete rows"
|
|
sidebarTitle: "Delete"
|
|
description: "Select and delete records, verify the remaining rows, and understand storage retention."
|
|
icon: trash
|
|
availability:
|
|
oss: available
|
|
enterprise: available
|
|
summary: >-
|
|
Delete rows through the SDKs in LanceDB Embedded and LanceDB Enterprise. Storage reclamation follows compaction and retention policy.
|
|
---
|
|
|
|
import { RsExample as RsDeleteRows } from '/snippets/ingestion_delete.mdx';
|
|
import { TsDeleteRowsBody, TsDeleteRowsTail } from '/snippets/ingestion_examples.mdx';
|
|
import { PyDeleteRows } from '/snippets/ingestion_examples.mdx';
|
|
import { PyWriteWorkflow, TsWriteWorkflowBody, TsWriteWorkflowTail, RsWriteWorkflow } from '/snippets/ingestion_examples.mdx';
|
|
|
|
Deleting rows removes matching records from the current table contents. It
|
|
keeps the table and schema so you can continue reading and writing. To remove
|
|
the table itself, see [Drop a table](/ingestion/create-table#drop-a-table).
|
|
|
|
## Inspect the rows you intend to delete {#select-rows}
|
|
|
|
Use the same predicate for inspection and deletion. The example below creates
|
|
Alice, Bob and Charlie, prints Charlie's row, and deletes it by `id = 3`.
|
|
Inspection and deletion are separate operations; concurrent writes can change
|
|
which rows match between them.
|
|
|
|
## Delete matching records {#delete-rows}
|
|
|
|
Each program creates Alice, Bob and Charlie in a temporary local database,
|
|
deletes Charlie, and prints the remaining rows: **Alice and Bob**. The temporary
|
|
database is removed when the program finishes.
|
|
|
|
- **Python:** install `lancedb`, save the code as `delete_rows.py`, and run
|
|
`python delete_rows.py`.
|
|
- **TypeScript:** install `@lancedb/lancedb`, save the code as `delete_rows.mts`,
|
|
and run `node delete_rows.mts` with Node.js 22.18 or later.
|
|
- **Rust:** download the [Rust examples](/static/code/ingestion-feedback-rust.zip),
|
|
extract the project, and run `cargo run --locked --bin delete`.
|
|
|
|
<CodeGroup>
|
|
<CodeBlock filename="Python" language="python" icon="python">
|
|
{PyDeleteRows}
|
|
</CodeBlock>
|
|
<CodeBlock filename="TypeScript" language="typescript" icon="square-js">
|
|
{TsDeleteRowsBody}
|
|
{TsDeleteRowsTail}
|
|
</CodeBlock>
|
|
<CodeBlock filename="Rust" language="rust" icon="rust">
|
|
{RsDeleteRows}
|
|
</CodeBlock>
|
|
</CodeGroup>
|
|
|
|
Enterprise also supports [`DELETE`](/sql/dml/delete).
|
|
|
|
## Verify that the rows are absent {#verify}
|
|
|
|
Query the same predicate after deletion and check the remaining row count.
|
|
A reader still using an older snapshot may see the earlier contents; see
|
|
[Consistency](/tables/consistency).
|
|
|
|
Deleted rows are excluded from current query results, including indexed
|
|
searches. Deletion does not imply immediate physical erasure of every stored
|
|
copy of the data.
|
|
|
|
## Understand storage reclamation {#storage}
|
|
|
|
Compaction rewrites the live data layout; cleanup removes eligible retained
|
|
versions and files. Retained history can continue to reference data that no
|
|
longer appears in the latest table version.
|
|
|
|
In LanceDB Embedded, `optimize()` provides maintenance operations. In Enterprise, managed
|
|
maintenance and retention follow the service configuration. Choose retention
|
|
according to the history you need, rather than shortening it as part of a
|
|
routine delete example. See [Compaction](/maintenance/compaction) and
|
|
[Cleanup](/maintenance/cleanup) for the separate maintenance workflow.
|
|
|
|
## 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>
|