mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-26 20:44:00 +00:00
The Rust example downloads in the ingestion, search, reranking and SQL guides point to `/static/code/*.zip` URLs that return HTTP 404 on the published docs site. Replace all 15 references across 13 pages with public GitHub downloads pinned to commit `2af85bea8999c8cd23ec01ff62ba110c54652c10`. The three archives already exist in this repository. Pinning their URLs preserves the exact source, dependency manifests and lockfiles used by the existing `cargo run --locked` instructions. Only link destinations change. Validation: - All three public download URLs return HTTP 200 with ZIP content. Downloaded bytes match the repository archives and the deployed docs source archives exactly, and ZIP integrity checks pass. - Verified that the diff contains exactly 15 URL replacements in 13 pages. No example code, run instructions, manifests or lockfiles changed. - `git diff --check` passes. - `mint broken-links` reports the same 16 existing missing internal links on both the unchanged `main` baseline and this branch. - `mint validate` reports four existing missing snippet exports (`RsExampleBody` and `RsExampleTail` in the reranking and vector-search pages); the unchanged baseline has the same warnings. The combined docs build and internal-link check pass with the equivalent download-link fix.
96 lines
4.3 KiB
Plaintext
96 lines
4.3 KiB
Plaintext
---
|
|
title: "Ingesting data"
|
|
sidebarTitle: "Overview"
|
|
description: "Choose how to create a table, append records or change existing data."
|
|
icon: inbox
|
|
keywords: ["ingest", "create table", "add", "insert", "arrow", "pandas", "polars", "pydantic"]
|
|
availability:
|
|
embedded: available
|
|
enterprise: available
|
|
---
|
|
|
|
import { PyWriteWorkflow, TsWriteWorkflowBody, TsWriteWorkflowTail, RsWriteWorkflow } from '/snippets/ingestion_examples.mdx';
|
|
|
|
Ingestion brings data into a LanceDB table. Start by choosing a schema and
|
|
creating the table, then choose a write operation according to how incoming
|
|
records relate to data already stored.
|
|
|
|
## Choose a write operation {#choose-a-write-method}
|
|
|
|
| Task | Operation | What happens |
|
|
| --- | --- | --- |
|
|
| [Create a table](/ingestion/create-table) | `create_table` / `createTable` | Create a table from data or an explicit schema. |
|
|
| [Append records](/ingestion/insert) | `add` | Add rows without matching existing keys. |
|
|
| [Upsert by key](/ingestion/merge-insert) | `merge_insert` / `mergeInsert` | Choose whether matching rows are updated and new keys inserted. |
|
|
| [Update selected rows](/ingestion/update) | `update` | Change values in rows selected by a predicate. |
|
|
| [Delete selected rows](/ingestion/delete) | `delete` | Remove matching rows from the current table contents. |
|
|
|
|
Appending the same input twice can create duplicate records. Use merge insert
|
|
with a stable key when the incoming data should update existing records.
|
|
|
|
## Connect and prepare the data {#connect-to-lancedb}
|
|
|
|
Use the [connection guide](/basics/catalog) to connect to Embedded or Enterprise.
|
|
The SDK write operations in this section work with both. Enterprise also
|
|
supports [SQL write statements](/sql#dml); an SDK filter expression does not
|
|
require a separate SQL connection.
|
|
|
|
Choose the column types, required fields and vector dimensions before a large
|
|
load. SDKs support different input representations, including row objects and
|
|
Arrow batches. The [table creation guide](/ingestion/create-table) covers
|
|
those choices.
|
|
|
|
## Try a complete write workflow {#create-the-example-table}
|
|
|
|
This example starts with Alice and Bob, appends Charlie, updates Bob's name
|
|
and login count, then merges a batch containing Charlie and Dana. Finally, it
|
|
selects Dana's row for inspection and deletes it.
|
|
|
|
<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](https://raw.githubusercontent.com/lancedb/lancedb/2af85bea8999c8cd23ec01ff62ba110c54652c10/docs/web/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>
|
|
|
|
## Verify the result {#verify}
|
|
|
|
After a write completes, inspect the affected keys and fields and check the row
|
|
count. SDK return values differ by operation and language; use the relevant
|
|
API reference when relying on returned counts or version metadata.
|
|
|
|
Readers with older snapshots may not see another handle's writes immediately.
|
|
See [Consistency](/tables/consistency). A table checked out at a historical
|
|
version must return to the latest version before it can be modified.
|
|
|
|
## Load larger datasets {#large-loads}
|
|
|
|
Use batches or file-backed input when the dataset is too large to hold in
|
|
memory. The [insert guide](/ingestion/insert#large-datasets) covers input
|
|
formats, progress reporting and write parallelism. Keep retry behavior in mind:
|
|
repeating an append is not the same as retrying a key-based upsert.
|