From 52e341ee9777d04f9fb07054980ba087c55c033e Mon Sep 17 00:00:00 2001 From: Timon Vonk Date: Mon, 30 Dec 2024 18:33:30 +0100 Subject: [PATCH] feat(lancedb): Public method for opening table (#514) --- swiftide-integrations/src/lancedb/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/swiftide-integrations/src/lancedb/mod.rs b/swiftide-integrations/src/lancedb/mod.rs index 95a46492..e959c4ad 100644 --- a/swiftide-integrations/src/lancedb/mod.rs +++ b/swiftide-integrations/src/lancedb/mod.rs @@ -113,6 +113,19 @@ impl LanceDB { .await .map_err(|e| anyhow::anyhow!(e)) } + + /// Opens the lancedb table + /// + /// # Errors + /// + /// Returns an error if the table cannot be opened or the connection cannot be acquired. + pub async fn open_table(&self) -> Result { + let conn = self.get_connection().await?; + conn.open_table(&self.table_name) + .execute() + .await + .context("Failed to open table") + } } impl LanceDBBuilder {