mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
aurweb.db: only pass check_same_thread with sqlite
Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
e0eb6b0e76
commit
3f1f03e03c
1 changed files with 6 additions and 4 deletions
|
@ -59,10 +59,12 @@ def get_engine():
|
||||||
global engine, session, Session
|
global engine, session, Session
|
||||||
|
|
||||||
if engine is None:
|
if engine is None:
|
||||||
engine = create_engine(get_sqlalchemy_url(),
|
connect_args = dict()
|
||||||
|
if aurweb.config.get("database", "backend") == "sqlite":
|
||||||
# check_same_thread is for a SQLite technicality
|
# check_same_thread is for a SQLite technicality
|
||||||
# https://fastapi.tiangolo.com/tutorial/sql-databases/#note
|
# https://fastapi.tiangolo.com/tutorial/sql-databases/#note
|
||||||
connect_args={"check_same_thread": False})
|
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 = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||||
session = Session()
|
session = Session()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue