Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
37a5d2c0
Commit
37a5d2c0
authored
Jul 03, 2024
by
Timothy J. Baek
Browse files
Update db.py
parent
86464609
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
backend/apps/webui/internal/db.py
backend/apps/webui/internal/db.py
+11
-0
No files found.
backend/apps/webui/internal/db.py
View file @
37a5d2c0
...
@@ -53,8 +53,19 @@ if "sqlite" in SQLALCHEMY_DATABASE_URL:
...
@@ -53,8 +53,19 @@ if "sqlite" in SQLALCHEMY_DATABASE_URL:
)
)
else
:
else
:
engine
=
create_engine
(
SQLALCHEMY_DATABASE_URL
,
pool_pre_ping
=
True
)
engine
=
create_engine
(
SQLALCHEMY_DATABASE_URL
,
pool_pre_ping
=
True
)
SessionLocal
=
sessionmaker
(
SessionLocal
=
sessionmaker
(
autocommit
=
False
,
autoflush
=
False
,
bind
=
engine
,
expire_on_commit
=
False
autocommit
=
False
,
autoflush
=
False
,
bind
=
engine
,
expire_on_commit
=
False
)
)
Base
=
declarative_base
()
Base
=
declarative_base
()
Session
=
scoped_session
(
SessionLocal
)
Session
=
scoped_session
(
SessionLocal
)
# Dependency
def
get_db
():
db
=
SessionLocal
()
try
:
yield
db
finally
:
db
.
close
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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