MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _autoflush

Method _autoflush

lib/sqlalchemy/orm/session.py:3161–3175  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3159 sa_exc.SAWarning,
3160 )
3161 def _autoflush(self) -> None:
3162 if self.autoflush and not self._flushing:
3163 try:
3164 self.flush()
3165 except sa_exc.StatementError as e:
3166 # note we are reraising StatementError as opposed to
3167 # raising FlushError with "chaining" to remain compatible
3168 # with code that catches StatementError, IntegrityError,
3169 # etc.
3170 e.add_detail(
3171 "raised as a result of Query-invoked autoflush; "
3172 "consider using a session.no_autoflush block if this "
3173 "flush is occurring prematurely"
3174 )
3175 raise e.with_traceback(sys.exc_info()[2])
3176
3177 def refresh(
3178 self,

Callers 10

_execute_internalMethod · 0.95
refreshMethod · 0.95
mergeMethod · 0.95
merge_allMethod · 0.95
orm_pre_session_execMethod · 0.80
orm_pre_session_execMethod · 0.80
orm_pre_session_execMethod · 0.80
orm_pre_session_execMethod · 0.80
merge_frozen_resultFunction · 0.80
merge_resultFunction · 0.80

Calls 2

flushMethod · 0.95
add_detailMethod · 0.80

Tested by

no test coverage detected