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 :

Classe « Query »

Méthode sqlalchemy.orm.Query.with_polymorphic

Signature de la méthode with_polymorphic

def with_polymorphic(self, cls_or_mappers, selectable=None, polymorphic_on=None) 

Description

with_polymorphic.__doc__

Load columns for inheriting classes.

.. deprecated:: 1.4 The :meth:`_orm.Query.with_polymorphic` method is considered legacy as of the 1.x series of SQLAlchemy and will be removed in 2.0. Use the orm.with_polymorphic() standalone function (Background on SQLAlchemy 2.0 at: :ref:`migration_20_toplevel`)

This is a legacy method which is replaced by the
:func:`_orm.with_polymorphic` function.

.. warning:: The :meth:`_orm.Query.with_polymorphic` method does
   **not** support 1.4/2.0 style features including
   :func:`_orm.with_loader_criteria`.  Please migrate code
   to use :func:`_orm.with_polymorphic`.

:meth:`_query.Query.with_polymorphic` applies transformations
to the "main" mapped class represented by this :class:`_query.Query`.
The "main" mapped class here means the :class:`_query.Query`
object's first argument is a full class, i.e.
``session.query(SomeClass)``. These transformations allow additional
tables to be present in the FROM clause so that columns for a
joined-inheritance subclass are available in the query, both for the
purposes of load-time efficiency as well as the ability to use
these columns at query time.

.. seealso::

    :ref:`with_polymorphic` - illustrates current patterns