Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(db): parameterize sessionmaker with Session (#30612)

-LAN-1f5d744cc27e
diff --git a/api/core/db/session_factory.py b/api/core/db/session_factory.py
index 1dae2eafd4b..45d4bc45948 100644
--- a/api/core/db/session_factory.py
+++ b/api/core/db/session_factory.py
@@ -1,7 +1,7 @@
from sqlalchemy import Engine
from sqlalchemy.orm import Session, sessionmaker
-_session_maker: sessionmaker | None = None
+_session_maker: sessionmaker[Session] | None = None
def configure_session_factory(engine: Engine, expire_on_commit: bool = False):
@@ -10,7 +10,7 @@ def configure_session_factory(engine: Engine, expire_on_commit: bool = False):
_session_maker = sessionmaker(bind=engine, expire_on_commit=expire_on_commit)
-def get_session_maker() -> sessionmaker:
+def get_session_maker() -> sessionmaker[Session]:
if _session_maker is None:
raise RuntimeError("Session factory not configured. Call configure_session_factory() first.")
return _session_maker
@@ -27,7 +27,7 @@ class SessionFactory:
configure_session_factory(engine, expire_on_commit)
@staticmethod
- def get_session_maker() -> sessionmaker:
+ def get_session_maker() -> sessionmaker[Session]:
return get_session_maker()
@staticmethod