Skip to content

Commit 4e7b847

Browse files
fix: Update SessionContextHolder to use PySpringSession
1 parent 7c7cc55 commit 4e7b847

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

py_spring_model/core/session_context_holder.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from contextvars import ContextVar
22
from functools import wraps
33
from typing import Any, Callable, ClassVar, Optional
4-
from sqlmodel import Session
4+
5+
from py_spring_model.core.py_spring_session import PySpringSession
56

67
from py_spring_model.core.model import PySpringModel
78

@@ -67,9 +68,9 @@ class SessionContextHolder:
6768
This is useful for the query service to be able to access the session without having to pass it in as an argument.
6869
This is also useful for the query service to be able to access the session without having to pass it in as an argument.
6970
"""
70-
_session: ClassVar[ContextVar[Optional[Session]]] = ContextVar("session", default=None)
71+
_session: ClassVar[ContextVar[Optional[PySpringSession]]] = ContextVar("session", default=None)
7172
@classmethod
72-
def get_or_create_session(cls) -> Session:
73+
def get_or_create_session(cls) -> PySpringSession:
7374
optional_session = cls._session.get()
7475
if optional_session is None:
7576
session = PySpringModel.create_session()

0 commit comments

Comments
 (0)