File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change 2121# Retry policy for DB-locked operations
2222DB_LOCK_RETRY_COUNT = 6
2323DB_LOCK_RETRY_BASE_DELAY = 0.05 # seconds, exponential backoff multiplier
24- _sqlite_vector_loaded = False
2524
2625
2726def connect_db (db_path : str , timeout : float = 30.0 ) -> sqlite3 .Connection :
@@ -53,26 +52,19 @@ def load_sqlite_vector_extension(conn: sqlite3.Connection) -> None:
5352 CRITICAL: This function will ALWAYS crash the program if the extension fails to load.
5453 STRICT mode is mandatory and cannot be disabled.
5554
55+ NOTE: SQLite extensions are loaded per-connection, not per-process. This function must be
56+ called for each connection that needs vector operations.
57+
5658 Args:
5759 conn: SQLite database connection
5860
5961 Raises:
6062 RuntimeError: If the extension fails to load
6163 """
62- global _sqlite_vector_loaded
63-
64- if _sqlite_vector_loaded :
65- logger .debug ("sqlite-vector: already loaded in-process, skipping load." )
66- return
67-
6864 try :
6965 ext_path = importlib .resources .files (SQLITE_VECTOR_PKG ) / SQLITE_VECTOR_RESOURCE
7066 conn .load_extension (str (ext_path ))
71- _sqlite_vector_loaded = True
72- try :
73- conn .enable_load_extension (False )
74- except Exception :
75- pass
67+ logger .debug (f"sqlite-vector extension loaded for connection { id (conn )} " )
7668 # optional quick check: call vector_version()
7769 try :
7870 cur = conn .execute (f"SELECT { SQLITE_VECTOR_VERSION_FN } ()" )
You can’t perform that action at this time.
0 commit comments