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_parent

Signature de la méthode with_parent

def with_parent(self, instance, property=None, from_entity=None) 

Description

with_parent.__doc__

Add filtering criterion that relates the given instance
to a child object or collection, using its attribute state
as well as an established :func:`_orm.relationship()`
configuration.

.. deprecated:: 1.4 The :meth:`_orm.Query.with_parent` method is considered legacy as of the 1.x series of SQLAlchemy and becomes a legacy construct in 2.0. Use the :func:`_orm.with_parent` standalone construct. (Background on SQLAlchemy 2.0 at: :ref:`migration_20_toplevel`)

The method uses the :func:`.with_parent` function to generate
the clause, the result of which is passed to
:meth:`_query.Query.filter`.

Parameters are the same as :func:`.with_parent`, with the exception
that the given property can be None, in which case a search is
performed against this :class:`_query.Query` object's target mapper.

:param instance:
  An instance which has some :func:`_orm.relationship`.

:param property:
  String property name, or class-bound attribute, which indicates
  what relationship from the instance should be used to reconcile the
  parent/child relationship.

:param from_entity:
  Entity in which to consider as the left side.  This defaults to the
  "zero" entity of the :class:`_query.Query` itself.