Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Joakim Saario
aurweb
Commits
b4142245
Commit
b4142245
authored
May 16, 2021
by
Kevin Morris
Browse files
aurweb.db: only pass check_same_thread with sqlite
Signed-off-by:
Kevin Morris
<
kevr@0cost.org
>
parent
25393dc3
Changes
1
Hide whitespace changes
Inline
Side-by-side
aurweb/db.py
View file @
b4142245
...
...
@@ -49,10 +49,15 @@ def get_engine():
from
sqlalchemy
import
create_engine
global
engine
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
()
return
engine
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment