Parcourir la source

Set `check_same_thread` false so that one App can be used in parallel (#911)

Sidharth Mohanty il y a 1 an
Parent
commit
d8cdbe0041
2 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 1 1
      embedchain/embedchain.py
  2. 1 1
      embedchain/pipeline.py

+ 1 - 1
embedchain/embedchain.py

@@ -88,7 +88,7 @@ class EmbedChain(JSONSerializable):
         self._telemetry_props = {"class": self.__class__.__name__}
         self.telemetry = AnonymousTelemetry(enabled=self.config.collect_metrics)
         # Establish a connection to the SQLite database
-        self.connection = sqlite3.connect(SQLITE_PATH)
+        self.connection = sqlite3.connect(SQLITE_PATH, check_same_thread=False)
         self.cursor = self.connection.cursor()
 
         # Create the 'data_sources' table if it doesn't exist

+ 1 - 1
embedchain/pipeline.py

@@ -120,7 +120,7 @@ class Pipeline(EmbedChain):
         self.telemetry = AnonymousTelemetry(enabled=self.config.collect_metrics)
 
         # Establish a connection to the SQLite database
-        self.connection = sqlite3.connect(SQLITE_PATH)
+        self.connection = sqlite3.connect(SQLITE_PATH, check_same_thread=False)
         self.cursor = self.connection.cursor()
 
         # Create the 'data_sources' table if it doesn't exist