mirror of
https://github.com/simple-login/app.git
synced 2024-09-08 19:31:30 +02:00
16 lines
468 B
Python
16 lines
468 B
Python
import sqlalchemy
|
|
from sqlalchemy import create_engine
|
|
from sqlalchemy.orm import scoped_session
|
|
from sqlalchemy.orm import sessionmaker
|
|
|
|
from app.config import DB_URI
|
|
|
|
engine = create_engine(DB_URI)
|
|
connection = engine.connect()
|
|
|
|
Session = scoped_session(sessionmaker(bind=connection))
|
|
|
|
# Session is actually a proxy, more info on
|
|
# https://docs.sqlalchemy.org/en/14/orm/contextual.html?highlight=scoped_session#implicit-method-access
|
|
Session: sqlalchemy.orm.Session
|