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 ? Calcul scientifique
avec Python
Voir le programme détaillé
Classe « Query »

Méthode sqlalchemy.orm.Query.select_from

Signature de la méthode select_from

def select_from(self, *from_obj: '_FromClauseArgument') -> 'Self' 

Description

help(Query.select_from)

Set the FROM clause of this :class:`.Query` explicitly.

:meth:`.Query.select_from` is often used in conjunction with
:meth:`.Query.join` in order to control which entity is selected
from on the "left" side of the join.

The entity or selectable object here effectively replaces the
"left edge" of any calls to :meth:`~.Query.join`, when no
joinpoint is otherwise established - usually, the default "join
point" is the leftmost entity in the :class:`~.Query` object's
list of entities to be selected.

A typical example::

    q = (
        session.query(Address)
        .select_from(User)
        .join(User.addresses)
        .filter(User.name == "ed")
    )

Which produces SQL equivalent to:

.. sourcecode:: sql

    SELECT address.* FROM user
    JOIN address ON user.id=address.user_id
    WHERE user.name = :name_1

:param \*from_obj: collection of one or more entities to apply
 to the FROM clause.  Entities can be mapped classes,
 :class:`.AliasedClass` objects, :class:`.Mapper` objects
 as well as core :class:`.FromClause` elements like subqueries.

.. seealso::

    :meth:`~.Query.join`

    :meth:`.Query.select_entity_from`

    :meth:`_sql.Select.select_from` - v2 equivalent method.



Vous êtes un professionnel et vous avez besoin d'une formation ? Coder avec une
Intelligence Artificielle
Voir le programme détaillé