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 ? Mise en oeuvre d'IHM
avec Qt et PySide6
Voir le programme détaillé
Classe « registry »

Méthode sqlalchemy.orm.registry.map_declaratively

Signature de la méthode map_declaratively

def map_declaratively(self, cls: 'Type[_O]') -> 'Mapper[_O]' 

Description

help(registry.map_declaratively)

Map a class declaratively.

In this form of mapping, the class is scanned for mapping information,
including for columns to be associated with a table, and/or an
actual table object.

Returns the :class:`_orm.Mapper` object.

E.g.::

    from sqlalchemy.orm import registry

    mapper_registry = registry()


    class Foo:
        __tablename__ = "some_table"

        id = Column(Integer, primary_key=True)
        name = Column(String)


    mapper = mapper_registry.map_declaratively(Foo)

This function is more conveniently invoked indirectly via either the
:meth:`_orm.registry.mapped` class decorator or by subclassing a
declarative metaclass generated from
:meth:`_orm.registry.generate_base`.

See the section :ref:`orm_declarative_mapping` for complete
details and examples.

:param cls: class to be mapped.

:return: a :class:`_orm.Mapper` object.

.. seealso::

    :ref:`orm_declarative_mapping`

    :meth:`_orm.registry.mapped` - more common decorator interface
    to this function.

    :meth:`_orm.registry.map_imperatively`



Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé