MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _optional_conn_ctx_manager

Method _optional_conn_ctx_manager

lib/sqlalchemy/engine/base.py:3190–3197  ·  view source on GitHub ↗
(
        self, connection: Optional[Connection] = None
    )

Source from the content-addressed store, hash-verified

3188
3189 @contextlib.contextmanager
3190 def _optional_conn_ctx_manager(
3191 self, connection: Optional[Connection] = None
3192 ) -> Iterator[Connection]:
3193 if connection is None:
3194 with self.connect() as conn:
3195 yield conn
3196 else:
3197 yield connection
3198
3199 @contextlib.contextmanager
3200 def begin(self) -> Iterator[Connection]:

Callers

nothing calls this directly

Calls 1

connectMethod · 0.95

Tested by

no test coverage detected