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 ? Coder avec une
Intelligence Artificielle
Voir le programme détaillé
Module « sqlalchemy.orm »

Classe « Mapper »

Informations générales

Héritage

                    builtins.object
                        Generic
                    builtins.object
                        EventTarget
                builtins.object
                    Generic
                        Inspectable
                    builtins.object
                        Identified
                    builtins.object
                        InspectionAttr
                builtins.object
                    HasMemoized
                builtins.object
                    HasCacheKey
                        MemoizedHasCacheKey
        builtins.object
            SQLRole
        builtins.object
            Generic
                TypedColumnsClauseRole
    builtins.object
        SQLRole
            ColumnListRole
        builtins.object
            UsesInspection
        builtins.object
            AllowsLambdaRole
                ColumnsClauseRole
                    ORMColumnsClauseRole
                        ORMEntityColumnsClauseRole
builtins.object
    SQLRole
        StructuralRole
    builtins.object
        UsesInspection
    builtins.object
        AllowsLambdaRole
            JoinTargetRole
builtins.object
    SQLRole
        ColumnListRole
    builtins.object
        UsesInspection
    builtins.object
        AllowsLambdaRole
            ColumnsClauseRole
                FromClauseRole
                    StrictFromClauseRole
                        ORMFromClauseRole
                            Mapper

Définition

class Mapper(ORMFromClauseRole, ORMEntityColumnsClauseRole, MemoizedHasCacheKey, InspectionAttr, Identified, Inspectable, EventTarget, Generic):

help(Mapper)

Defines an association between a Python class and a database table or
other relational structure, so that ORM operations against the class may
proceed.

The :class:`_orm.Mapper` object is instantiated using mapping methods
present on the :class:`_orm.registry` object.  For information
about instantiating new :class:`_orm.Mapper` objects, see
:ref:`orm_mapping_classes_toplevel`.

Constructeur(s)

Signature du constructeur Description
__init__(self, class_: 'Type[_O]', local_table: 'Optional[FromClause]' = None, properties: 'Optional[Mapping[str, MapperProperty[Any]]]' = None, primary_key: 'Optional[Iterable[_ORMColumnExprArgument[Any]]]' = None, non_primary: 'bool' = False, inherits: 'Optional[Union[Mapper[Any], Type[Any]]]' = None, inherit_condition: 'Optional[_ColumnExpressionArgument[bool]]' = None, inherit_foreign_keys: 'Optional[Sequence[_ORMColumnExprArgument[Any]]]' = None, always_refresh: 'bool' = False, version_id_col: 'Optional[_ORMColumnExprArgument[Any]]' = None, version_id_generator: 'Optional[Union[Literal[False], Callable[[Any], Any]]]' = None, polymorphic_on: 'Optional[Union[_ORMColumnExprArgument[Any], str, MapperProperty[Any]]]' = None, _polymorphic_map: 'Optional[Dict[Any, Mapper[Any]]]' = None, polymorphic_identity: 'Optional[Any]' = None, concrete: 'bool' = False, with_polymorphic: 'Optional[_WithPolymorphicArg]' = None, polymorphic_abstract: 'bool' = False, polymorphic_load: "Optional[Literal['selectin', 'inline']]" = None, allow_partial_pks: 'bool' = True, batch: 'bool' = True, column_prefix: 'Optional[str]' = None, include_properties: 'Optional[Sequence[str]]' = None, exclude_properties: 'Optional[Sequence[str]]' = None, passive_updates: 'bool' = True, passive_deletes: 'bool' = False, confirm_deleted_rows: 'bool' = True, eager_defaults: "Literal[True, False, 'auto']" = 'auto', legacy_is_orphan: 'bool' = False, _compiled_cache_size: 'int' = 100) Direct constructor for a new :class:`_orm.Mapper` object. [extrait de __init__.__doc__]

Liste des attributs statiques

Nom de l'attribut Valeur
all_orm_descriptors
allows_lambda
attrs
column_attrs
composites
configured
dispatch
extension_type
inherit_cache
is_aliased_class
is_attribute
is_bundle
is_clause_element
is_instance
is_mapper
is_property
is_selectable
logger
logging_name
mapped_table
relationships
represents_outer_join
select_identity_token
self_and_descendants
synonyms
uses_inspection
with_polymorphic_mappers

Liste des propriétés

Nom de la propriétéDescription
entityPart of the inspection API. [extrait de entity.__doc__]
entity_namespace
iterate_propertiesreturn an iterator of all MapperProperty objects. [extrait de iterate_properties.__doc__]
mapperPart of the inspection API. [extrait de mapper.__doc__]
primary_base_mapper
selectableThe :class:`_schema.FromClause` construct this [extrait de selectable.__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__]
__clause_element__(self)
__repr__(self) -> 'str'
__str__(self) -> 'str'
add_properties(self, dict_of_properties) Add the given dictionary of properties to this mapper, [extrait de add_properties.__doc__]
add_property(self, key: 'str', prop: 'Union[Column[Any], MapperProperty[Any]]') -> 'None' Add an individual MapperProperty to this mapper. [extrait de add_property.__doc__]
cascade_iterator(self, type_: 'str', state: 'InstanceState[_O]', halt_on: 'Optional[Callable[[InstanceState[Any]], bool]]' = None) -> 'Iterator[Tuple[object, Mapper[Any], InstanceState[Any], _InstanceDict]]' Iterate each element and its mapper in an object graph, [extrait de cascade_iterator.__doc__]
common_parent(self, other: 'Mapper[Any]') -> 'bool' Return true if the given mapper shares a [extrait de common_parent.__doc__]
get_property(self, key: 'str', _configure_mappers: 'bool' = False) -> 'MapperProperty[Any]' return a MapperProperty associated with the given key. [extrait de get_property.__doc__]
get_property_by_column(self, column: 'ColumnElement[_T]') -> 'MapperProperty[_T]' Given a :class:`_schema.Column` object, return the [extrait de get_property_by_column.__doc__]
has_property(self, key: 'str') -> 'bool'
identity_key_from_instance(self, instance: '_O') -> '_IdentityKeyType[_O]' Return the identity key for the given instance, based on [extrait de identity_key_from_instance.__doc__]
identity_key_from_primary_key(self, primary_key: 'Tuple[Any, ...]', identity_token: 'Optional[Any]' = None) -> '_IdentityKeyType[_O]' Return an identity-map key for use in storing/retrieving an [extrait de identity_key_from_primary_key.__doc__]
identity_key_from_row(self, row: 'Optional[Union[Row[Any], RowMapping]]', identity_token: 'Optional[Any]' = None, adapter: 'Optional[ORMAdapter]' = None) -> '_IdentityKeyType[_O]' Return an identity-map key for use in storing/retrieving an [extrait de identity_key_from_row.__doc__]
is_sibling(self, other: 'Mapper[Any]') -> 'bool' return true if the other mapper is an inheriting sibling to this [extrait de is_sibling.__doc__]
isa(self, other: 'Mapper[Any]') -> 'bool' Return True if the this mapper inherits from the given mapper. [extrait de isa.__doc__]
iterate_to_root(self) -> 'Iterator[Mapper[Any]]'
polymorphic_iterator(self) -> 'Iterator[Mapper[Any]]' Iterate through the collection including this mapper and [extrait de polymorphic_iterator.__doc__]
primary_key_from_instance(self, instance: '_O') -> 'Tuple[Any, ...]' Return the list of primary key values for the given [extrait de primary_key_from_instance.__doc__]
primary_mapper(self) -> 'Mapper[Any]' Return the primary mapper corresponding to this mapper's class key [extrait de primary_mapper.__doc__]

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

__init_subclass__, __subclasshook__

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

memoized_attribute, memoized_instancemethod

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

__delattr__, __dir__, __format__, __getattribute__, __getstate__, __hash__, __reduce__, __reduce_ex__, __setattr__, __sizeof__

Vous êtes un professionnel et vous avez besoin d'une formation ? Mise en oeuvre d'IHM
avec Qt et PySide6
Voir le programme détaillé