fix: escape pysqlite swapping (#410)

This commit is contained in:
cachho
2023-08-09 09:24:41 +02:00
committed by GitHub
parent f2b563e42a
commit 2ef7c0b736

View File

@@ -60,6 +60,7 @@ def use_pysqlite3():
import sqlite3 import sqlite3
if platform.system() == "Linux" and sqlite3.sqlite_version_info < (3, 35, 0): if platform.system() == "Linux" and sqlite3.sqlite_version_info < (3, 35, 0):
try:
# According to the Chroma team, this patch only works on Linux # According to the Chroma team, this patch only works on Linux
import datetime import datetime
import subprocess import subprocess
@@ -79,3 +80,12 @@ def use_pysqlite3():
"Swapped std-lib sqlite3 with pysqlite3 for ChromaDb compatibility.", "Swapped std-lib sqlite3 with pysqlite3 for ChromaDb compatibility.",
f"Your original version was {sqlite3.sqlite_version}.", f"Your original version was {sqlite3.sqlite_version}.",
) )
except Exception as e:
# Escape all exceptions
current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S,%f")[:-3]
print(
f"{current_time} [embedchain] [ERROR]",
"Failed to swap std-lib sqlite3 with pysqlite3 for ChromaDb compatibility.",
f"Error:",
e
)