MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / session

Method session

lib/sqlalchemy/orm/dynamic.py:137–144  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

135
136 @property
137 def session(self) -> Optional[Session]:
138 sess = object_session(self.instance)
139 if sess is not None and sess.autoflush and self.instance in sess:
140 sess.flush()
141 if not orm_util.has_identity(self.instance):
142 return None
143 else:
144 return sess
145
146 @session.setter
147 def session(self, session: Session) -> None:

Callers

nothing calls this directly

Calls 3

object_sessionFunction · 0.85
has_identityMethod · 0.80
flushMethod · 0.45

Tested by

no test coverage detected