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

Method init

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

348 """
349
350 def init(self, target: _O, args: Any, kwargs: Any) -> None:
351 """Receive an instance when its constructor is called.
352
353 This method is only called during a userland construction of
354 an object, in conjunction with the object's constructor, e.g.
355 its ``__init__`` method. It is not called when an object is
356 loaded from the database; see the :meth:`.InstanceEvents.load`
357 event in order to intercept a database load.
358
359 The event is called before the actual ``__init__`` constructor
360 of the object is called. The ``kwargs`` dictionary may be
361 modified in-place in order to affect what is passed to
362 ``__init__``.
363
364 :param target: the mapped instance. If
365 the event is configured with ``raw=True``, this will
366 instead be the :class:`.InstanceState` state-management
367 object associated with the instance.
368 :param args: positional arguments passed to the ``__init__`` method.
369 This is passed as a tuple and is currently immutable.
370 :param kwargs: keyword arguments passed to the ``__init__`` method.
371 This structure *can* be altered in place.
372
373 .. seealso::
374
375 :meth:`.InstanceEvents.init_failure`
376
377 :meth:`.InstanceEvents.load`
378
379 """
380
381 def init_failure(self, target: _O, args: Any, kwargs: Any) -> None:
382 """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