mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
feat(sqlalchemy): use session factory instead of context manager
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user