From 8e876ef28d11b6747afa099e24db0dd2b11c8b54 Mon Sep 17 00:00:00 2001 From: Yiorgis Gozadinos Date: Fri, 3 Apr 2026 16:22:42 +0300 Subject: [PATCH] For remote stores, detect new db by checking if tables exist --- haiku_rag_slim/haiku/rag/store/engine.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/haiku_rag_slim/haiku/rag/store/engine.py b/haiku_rag_slim/haiku/rag/store/engine.py index 5ca06037..3620b8ff 100644 --- a/haiku_rag_slim/haiku/rag/store/engine.py +++ b/haiku_rag_slim/haiku/rag/store/engine.py @@ -149,6 +149,12 @@ class Store: # Connect to LanceDB self.db = connect_lancedb(self._config, db_path) + # For remote stores, detect new DB by checking if tables exist + if not is_new_db and self._connection_mode != ConnectionMode.LOCAL: + existing_tables = self.db.list_tables().tables + if not existing_tables: + is_new_db = True + # For existing databases, read stored vector dimension to create ChunkRecord # that can read existing chunks. For new databases, use config's dimension. stored_vector_dim = None