Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ The vector column holds 3-dimensional embeddings representing each character.
To ingest the data into LanceDB, obtain data of the required shape
and pass in the data object to the `create_table` method as shown below.
Note that LanceDB tables require a schema. If you don't provide one, LanceDB
will infer it from the data.
will infer it from the data. For the Rust snippet, you can find the helper functions in the
[code](https://github.com/lancedb/docs/blob/main/tests/rs/quickstart.rs).

<CodeGroup >
<CodeBlock filename="Python (sync)" language="Python" icon="python">
Expand Down Expand Up @@ -210,11 +211,10 @@ to be used downstream in your application.
</CodeBlock>
</Accordion>


<Info>
See the full code for these examples (including helper functions) in the
`quickstart` file for the appropriate client language in the
[docs repo](https://github.com/lancedb/docs/tree/main/tests).
[files provided here](https://github.com/lancedb/docs/tree/main/tests).
</Info>


Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const RsQuickstartCreateTable = "// Define an arrow schema named adventur

export const RsQuickstartCreateTableNoOverwrite = "table = db\n .create_table(\"adventurers\", adventurers_to_reader(schema.clone(), &data))\n .execute()\n .await\n .unwrap();\n";

export const RsQuickstartDefineStruct = "// Define a struct representing the data schema\n#[derive(Debug, Clone, Serialize, Deserialize)]\nstruct Adventurer {\n id: String,\n text: String,\n vector: [f32; 3],\n}\n";
export const RsQuickstartDefineStruct = "// Define a struct representing the data schema\n#[derive(Debug, Clone, Serialize, Deserialize)]\nstruct Adventurer {\n id: String,\n text: String,\n vector: [f32; 3],\n}\n\nfn adventurers_schema() -> Arc<Schema> {\n Arc::new(Schema::new(vec![\n Field::new(\"id\", DataType::LargeUtf8, false),\n Field::new(\"text\", DataType::LargeUtf8, false),\n Field::new(\n \"vector\",\n DataType::FixedSizeList(Arc::new(Field::new(\"item\", DataType::Float32, true)), 3),\n false,\n ),\n ]))\n}\n";

export const RsQuickstartOpenTable = "let table: Table = db.open_table(\"adventurers\").execute().await.unwrap();\n";

Expand Down
3 changes: 2 additions & 1 deletion docs/tables/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ existing table named `camelot`.
</CodeGroup>

Prepare the new records to add. Here, we add two new magical characters
via the `add` method.
via the `add` method. For the Rust snippet, you can find the helper functions in the
[code](https://github.com/lancedb/docs/blob/main/tests/rs/basic_usage.rs).

<CodeGroup >
<CodeBlock filename="Python" language="Python" icon="Python">
Expand Down
2 changes: 1 addition & 1 deletion tests/rs/quickstart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ struct Adventurer {
text: String,
vector: [f32; 3],
}
// --8<-- [end:quickstart_define_struct]

fn adventurers_schema() -> Arc<Schema> {
Arc::new(Schema::new(vec![
Expand All @@ -34,6 +33,7 @@ fn adventurers_schema() -> Arc<Schema> {
),
]))
}
// --8<-- [end:quickstart_define_struct]

type BatchIter = RecordBatchIterator<
std::vec::IntoIter<std::result::Result<RecordBatch, arrow_schema::ArrowError>>,
Expand Down
Loading