Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Sensibilisation à
l'Intelligence Artificielle
Voir le programme détaillé
Module « sqlalchemy.orm »

Classe « InstanceState »

Informations générales

Héritage

    builtins.object
        Generic
builtins.object
    InspectionAttr
        InspectionAttrInfo
            InstanceState

Définition

class InstanceState(InspectionAttrInfo, Generic):

help(InstanceState)

Tracks state information at the instance level.

The :class:`.InstanceState` is a key object used by the
SQLAlchemy ORM in order to track the state of an object;
it is created the moment an object is instantiated, typically
as a result of :term:`instrumentation` which SQLAlchemy applies
to the ``__init__()`` method of the class.

:class:`.InstanceState` is also a semi-public object,
available for runtime inspection as to the state of a
mapped instance, including information such as its current
status within a particular :class:`.Session` and details
about data on individual attributes.  The public API
in order to acquire a :class:`.InstanceState` object
is to use the :func:`_sa.inspect` system::

    >>> from sqlalchemy import inspect
    >>> insp = inspect(some_mapped_object)
    >>> insp.attrs.nickname.history
    History(added=['new nickname'], unchanged=(), deleted=['nickname'])

.. seealso::

    :ref:`orm_mapper_inspection_instancestate`

Constructeur(s)

Signature du constructeur Description
__init__(self, obj: '_O', manager: 'ClassManager[_O]')

Liste des attributs statiques

Nom de l'attribut Valeur
attrs<sqlalchemy.util.langhelpers._memoized_property object at 0x0000020DA0F6AED0>
callablesimmutabledict({})
class_<member 'class_' of 'InstanceState' objects>
committed_state<member 'committed_state' of 'InstanceState' objects>
expiredFalse
expired_attributes<member 'expired_attributes' of 'InstanceState' objects>
extension_typeNotExtension.NOT_EXTENSION
identity_tokenNone
info<sqlalchemy.util.langhelpers._memoized_property object at 0x0000020DA0E1F470>
insert_orderNone
is_aliased_classFalse
is_attributeFalse
is_bundleFalse
is_clause_elementFalse
is_instanceTrue
is_mapperFalse
is_propertyFalse
is_selectableFalse
keyNone
load_options()
load_pathORM Path[]
manager<member 'manager' of 'InstanceState' objects>
mapper<sqlalchemy.util.langhelpers._memoized_property object at 0x0000020DA0FA40B0>
modifiedFalse
obj<member 'obj' of 'InstanceState' objects>
parents<sqlalchemy.util.langhelpers._memoized_property object at 0x0000020DA0F6B3B0>
runidNone
session_idNone

Liste des propriétés

Nom de la propriétéDescription
async_sessionReturn the owning :class:`_asyncio.AsyncSession` for this instance, [extrait de async_session.__doc__]
deletedReturn ``True`` if the object is :term:`deleted`. [extrait de deleted.__doc__]
detachedReturn ``True`` if the object is :term:`detached`. [extrait de detached.__doc__]
dictReturn the instance dict used by the object. [extrait de dict.__doc__]
has_identityReturn ``True`` if this object has an identity key. [extrait de has_identity.__doc__]
identityReturn the mapped identity of the mapped object. [extrait de identity.__doc__]
identity_keyReturn the identity key for the mapped object. [extrait de identity_key.__doc__]
objectReturn the mapped object represented by this [extrait de object.__doc__]
pendingReturn ``True`` if the object is :term:`pending`. [extrait de pending.__doc__]
persistentReturn ``True`` if the object is :term:`persistent`. [extrait de persistent.__doc__]
sessionReturn the owning :class:`.Session` for this instance, [extrait de session.__doc__]
transientReturn ``True`` if the object is :term:`transient`. [extrait de transient.__doc__]
unloadedReturn the set of keys which do not have a loaded value. [extrait de unloaded.__doc__]
unloaded_expirableSynonymous with :attr:`.InstanceState.unloaded`. [extrait de unloaded_expirable.__doc__]
unmodifiedReturn the set of keys which have no uncommitted changes [extrait de unmodified.__doc__]
was_deletedReturn True if this object is or was previously in the [extrait de was_deleted.__doc__]

Liste des opérateurs

Opérateurs hérités de la classe object

__eq__, __ge__, __gt__, __le__, __lt__, __ne__

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__class_getitem__ Parameterizes a generic class. [extrait de __class_getitem__.__doc__]
__getstate__(self) -> 'Dict[str, Any]'
__setstate__(self, state_dict: 'Dict[str, Any]') -> 'None'
get_history(self, key: 'str', passive: 'PassiveFlag') -> 'History'
get_impl(self, key: 'str') -> 'AttributeImpl'
unmodified_intersection(self, keys: 'Iterable[str]') -> 'Set[str]' Return self.unmodified.intersection(keys). [extrait de unmodified_intersection.__doc__]

Méthodes héritées de la classe Generic

__init_subclass__, __subclasshook__

Méthodes héritées de la classe InspectionAttrInfo

__init_subclass__, __subclasshook__

Méthodes héritées de la classe object

__delattr__, __dir__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__

Vous êtes un professionnel et vous avez besoin d'une formation ? Deep Learning avec Python
et Keras et Tensorflow
Voir le programme détaillé