feat(sqlalchemy): use session factory instead of context manager

This commit is contained in:
Jonathan Rohde committed 2024-06-27 07:48:08 +02:00
1 parent eb01e8d275
commit da403f3e3c
15 files changed
+640 -759

No files matched your search

+1 -11
View File
@@ -57,14 +57,4 @@ SessionLocal = sessionmaker(
autocommit=False, autoflush=False, bind=engine, expire_on_commit=False
)
Base = declarative_base()
@contextmanager
def get_session():
session = scoped_session(SessionLocal)
try:
yield session
session.commit()
except Exception as e:
session.rollback()
raise e
Session = scoped_session(SessionLocal)