MCPcopy Index your code
hub / github.com/sqlalchemy/sqlalchemy / init_failure

Method init_failure

lib/sqlalchemy/orm/events.py:370–401  ·  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

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

Callers 1

_initialize_instanceMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected