MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / init_failure

Method init_failure

lib/sqlalchemy/orm/events.py:381–412  ·  view source on GitHub ↗

Receive an instance when its constructor has been called, and raised an exception. This method is only called during a userland construction of an object, in conjunction with the object's constructor, e.g. its ``__init__`` method. It is not called when an object is l

(self, target: _O, args: Any, kwargs: Any)

Source from the content-addressed store, hash-verified

379 """
380
381 def init_failure(self, target: _O, args: Any, kwargs: Any) -> None:
382 """Receive an instance when its constructor has been called,
383 and raised an exception.
384
385 This method is only called during a userland construction of
386 an object, in conjunction with the object's constructor, e.g.
387 its ``__init__`` method. It is not called when an object is loaded
388 from the database.
389
390 The event is invoked after an exception raised by the ``__init__``
391 method is caught. After the event
392 is invoked, the original exception is re-raised outwards, so that
393 the construction of the object still raises an exception. The
394 actual exception and stack trace raised should be present in
395 ``sys.exc_info()``.
396
397 :param target: the mapped instance. If
398 the event is configured with ``raw=True``, this will
399 instead be the :class:`.InstanceState` state-management
400 object associated with the instance.
401 :param args: positional arguments that were passed to the ``__init__``
402 method.
403 :param kwargs: keyword arguments that were passed to the ``__init__``
404 method.
405
406 .. seealso::
407
408 :meth:`.InstanceEvents.init`
409
410 :meth:`.InstanceEvents.load`
411
412 """
413
414 def _sa_event_merge_wo_load(
415 self, target: _O, context: QueryContext

Callers 1

_initialize_instanceMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected