Skip to content
Snippets Groups Projects
Commit 3f1f03e0 authored by Kevin Morris's avatar Kevin Morris
Browse files

aurweb.db: only pass check_same_thread with sqlite


Signed-off-by: Kevin Morris's avatarKevin Morris <kevr@0cost.org>
parent e0eb6b0e
No related branches found
No related tags found
No related merge requests found
......@@ -59,10 +59,12 @@ def get_engine():
global engine, session, Session
if engine is None:
engine = create_engine(get_sqlalchemy_url(),
# check_same_thread is for a SQLite technicality
# https://fastapi.tiangolo.com/tutorial/sql-databases/#note
connect_args={"check_same_thread": False})
connect_args = dict()
if aurweb.config.get("database", "backend") == "sqlite":
# check_same_thread is for a SQLite technicality
# https://fastapi.tiangolo.com/tutorial/sql-databases/#note
connect_args["check_same_thread"] = False
engine = create_engine(get_sqlalchemy_url(), connect_args=connect_args)
Session = sessionmaker(autocommit=False, autoflush=False, bind=engine)
session = Session()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment