MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / engine_connect

Method engine_connect

lib/sqlalchemy/engine/events.py:384–418  ·  view source on GitHub ↗

Intercept the creation of a new :class:`_engine.Connection`. This event is called typically as the direct result of calling the :meth:`_engine.Engine.connect` method. It differs from the :meth:`_events.PoolEvents.connect` method, which refers to the actual connectio

(self, conn: Connection)

Source from the content-addressed store, hash-verified

382 "2.0", ["conn", "branch"], converter=lambda conn: (conn, False)
383 )
384 def engine_connect(self, conn: Connection) -> None:
385 """Intercept the creation of a new :class:`_engine.Connection`.
386
387 This event is called typically as the direct result of calling
388 the :meth:`_engine.Engine.connect` method.
389
390 It differs from the :meth:`_events.PoolEvents.connect` method, which
391 refers to the actual connection to a database at the DBAPI level;
392 a DBAPI connection may be pooled and reused for many operations.
393 In contrast, this event refers only to the production of a higher level
394 :class:`_engine.Connection` wrapper around such a DBAPI connection.
395
396 It also differs from the :meth:`_events.PoolEvents.checkout` event
397 in that it is specific to the :class:`_engine.Connection` object,
398 not the
399 DBAPI connection that :meth:`_events.PoolEvents.checkout` deals with,
400 although
401 this DBAPI connection is available here via the
402 :attr:`_engine.Connection.connection` attribute.
403 But note there can in fact
404 be multiple :meth:`_events.PoolEvents.checkout`
405 events within the lifespan
406 of a single :class:`_engine.Connection` object, if that
407 :class:`_engine.Connection`
408 is invalidated and re-established.
409
410 :param conn: :class:`_engine.Connection` object.
411
412 .. seealso::
413
414 :meth:`_events.PoolEvents.checkout`
415 the lower-level pool checkout event
416 for an individual DBAPI connection
417
418 """
419
420 def set_connection_execution_options(
421 self, conn: Connection, opts: Dict[str, Any]

Callers 1

__init__Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected