MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / init

Method init

lib/sqlalchemy/orm/events.py:339–368  ·  view source on GitHub ↗

Receive an instance when its constructor is called. 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 loaded from the database; see t

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

Source from the content-addressed store, hash-verified

337 _InstanceEventsHold._clear()
338
339 def init(self, target: _O, args: Any, kwargs: Any) -> None:
340 """Receive an instance when its constructor is called.
341
342 This method is only called during a userland construction of
343 an object, in conjunction with the object's constructor, e.g.
344 its ``__init__`` method. It is not called when an object is
345 loaded from the database; see the :meth:`.InstanceEvents.load`
346 event in order to intercept a database load.
347
348 The event is called before the actual ``__init__`` constructor
349 of the object is called. The ``kwargs`` dictionary may be
350 modified in-place in order to affect what is passed to
351 ``__init__``.
352
353 :param target: the mapped instance. If
354 the event is configured with ``raw=True``, this will
355 instead be the :class:`.InstanceState` state-management
356 object associated with the instance.
357 :param args: positional arguments passed to the ``__init__`` method.
358 This is passed as a tuple and is currently immutable.
359 :param kwargs: keyword arguments passed to the ``__init__`` method.
360 This structure *can* be altered in place.
361
362 .. seealso::
363
364 :meth:`.InstanceEvents.init_failure`
365
366 :meth:`.InstanceEvents.load`
367
368 """
369
370 def init_failure(self, target: _O, args: Any, kwargs: Any) -> None:
371 """Receive an instance when its constructor has been called,

Callers 3

_initialize_instanceMethod · 0.45
_configure_propertyMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected