Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cocalibration Demonstrator Backend
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
M4D
Cocalibration Demonstrator Backend
Commits
593c5bf5
Commit
593c5bf5
authored
1 year ago
by
Maximilian Gruber
Browse files
Options
Downloads
Patches
Plain Diff
fix concurrency issue: use scoped session
parent
3165d443
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/database.py
+3
-2
3 additions, 2 deletions
app/database.py
with
3 additions
and
2 deletions
app/database.py
+
3
−
2
View file @
593c5bf5
from
sqlalchemy
import
create_engine
from
sqlalchemy.ext.declarative
import
declarative_base
from
sqlalchemy.orm
import
sessionmaker
from
sqlalchemy.orm
import
scoped_session
SQLALCHEMY_DATABASE_URL
=
"
sqlite:///./sql_app.db
"
engine
=
create_engine
(
SQLALCHEMY_DATABASE_URL
,
connect_args
=
{
"
check_same_thread
"
:
False
})
SessionLocal
=
sessionmaker
(
autocommit
=
False
,
autoflush
=
False
,
bind
=
engine
)
engine
=
create_engine
(
SQLALCHEMY_DATABASE_URL
,
connect_args
=
{
"
check_same_thread
"
:
False
})
# echo=True
SessionLocal
=
scoped_session
(
sessionmaker
(
autocommit
=
False
,
autoflush
=
False
,
bind
=
engine
)
)
Base
=
declarative_base
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment