mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-25 13:12:39 +00:00
docs: make the object-storage connection examples bind db
The quickstart says the TypeScript and Rust code of steps 2 to 5 makes one program, whichever connection the reader picks. The object-storage examples broke that: the TypeScript one defined an uncalled function whose db was local to it and had no import, and the Rust one declared uri but never connected. Both now bind db in the program's scope, as the local and Enterprise examples do, and the quickstart shows their import lines. The test functions that hold them stay uncalled, so no test reaches object storage. The connection guide shows the TypeScript example with its import line too.
This commit is contained in:
@@ -37,7 +37,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let db = connect_enterprise_quickstart().await?;
|
||||
println!("{:?}", db.table_names().execute().await?);
|
||||
}
|
||||
let _ = connect_object_storage_config();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -58,13 +57,15 @@ async fn connect_enterprise_quickstart() -> Result<Connection, Box<dyn std::erro
|
||||
Ok(db)
|
||||
}
|
||||
|
||||
fn connect_object_storage_config() -> &'static str {
|
||||
// Compiled as documentation, never called by the example runner.
|
||||
#[allow(dead_code)]
|
||||
async fn connect_object_storage() -> lancedb::Result<Connection> {
|
||||
// --8<-- [start:connect_object_storage]
|
||||
let uri = "s3://your-bucket/path";
|
||||
// You can also use "gs://your-bucket/path" or "az://your-container/path".
|
||||
let db = connect(uri).execute().await?;
|
||||
// --8<-- [end:connect_object_storage]
|
||||
|
||||
uri
|
||||
Ok(db)
|
||||
}
|
||||
|
||||
async fn namespace_table_ops_example(uri: &str) -> lancedb::Result<()> {
|
||||
|
||||
@@ -76,14 +76,14 @@ describe("enterprise quickstart connect", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// --8<-- [start:connect_object_storage]
|
||||
async function connectObjectStorageExample() {
|
||||
// --8<-- [start:connect_object_storage]
|
||||
const uri = "s3://your-bucket/path";
|
||||
// You can also use "gs://your-bucket/path" or "az://your-container/path".
|
||||
const db = await lancedb.connect(uri);
|
||||
// --8<-- [end:connect_object_storage]
|
||||
return db;
|
||||
}
|
||||
// --8<-- [end:connect_object_storage]
|
||||
|
||||
async function namespaceTableOpsExample() {
|
||||
// --8<-- [start:namespace_table_ops]
|
||||
|
||||
Reference in New Issue
Block a user