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 :

Module « sqlalchemy.orm »

Classe « Mapper »

Informations générales

Héritage

                    builtins.object
                        InspectionAttr
                builtins.object
                    HasMemoized
                builtins.object
                    HasCacheKey
                        MemoizedHasCacheKey
    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):

Description [extrait de Mapper.__doc__]

Define the correlation of class attributes to database table
    columns.

    The :class:`_orm.Mapper` object is instantiated using the
    :func:`~sqlalchemy.orm.mapper` function.    For information
    about instantiating new :class:`_orm.Mapper` objects, see
    that function's documentation.


    When :func:`.mapper` is used
    explicitly to link a user defined class with table
    metadata, this is referred to as *classical mapping*.
    Modern SQLAlchemy usage tends to favor the
    :mod:`sqlalchemy.ext.declarative` extension for class
    configuration, which
    makes usage of :func:`.mapper` behind the scenes.

    Given a particular class known to be mapped by the ORM,
    the :class:`_orm.Mapper` which maintains it can be acquired
    using the :func:`_sa.inspect` function::

        from sqlalchemy import inspect

        mapper = inspect(MyClass)

    A class which was mapped by the :mod:`sqlalchemy.ext.declarative`
    extension will also have its mapper available via the ``__mapper__``
    attribute.


    

Constructeur(s)

Signature du constructeur Description
__init__(self, class_, local_table=None, properties=None, primary_key=None, non_primary=False, inherits=None, inherit_condition=None, inherit_foreign_keys=None, always_refresh=False, version_id_col=None, version_id_generator=None, polymorphic_on=None, _polymorphic_map=None, polymorphic_identity=None, concrete=False, with_polymorphic=None, polymorphic_load=None, allow_partial_pks=True, batch=True, column_prefix=None, include_properties=None, exclude_properties=None, passive_updates=True, passive_deletes=False, confirm_deleted_rows=True, eager_defaults=False, legacy_is_orphan=False, _compiled_cache_size=100) Construct a new :class:`.Mapper` object. [extrait de __init__.__doc__]

Liste des attributs statiques

Nom de l'attribut Valeur
all_orm_descriptors
allows_lambda
attrs
base_mapper
c
class_
class_manager
column_attrs
columns
composites
concrete
configured
dispatch
extension_type
inherits
is_aliased_class
is_attribute
is_bundle
is_clause_element
is_instance
is_mapper
is_property
is_selectable
local_table
logger
non_primary
persist_selectable
polymorphic_identity
polymorphic_map
polymorphic_on
primary_key
relationships
represents_outer_join
select_identity_token
self_and_descendants
single
synonyms
tables
uses_inspection
validators
with_polymorphic_mappers

Liste des propriétés

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

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

__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__, __hash__, __reduce__, __reduce_ex__, __setattr__, __sizeof__