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 »

Fonction join - module sqlalchemy.orm

Signature de la fonction join

def join(left, right, onclause=None, isouter=False, full=False, join_to_left=None) 

Description

join.__doc__

Produce an inner join between left and right clauses.

    :func:`_orm.join` is an extension to the core join interface
    provided by :func:`_expression.join()`, where the
    left and right selectables may be not only core selectable
    objects such as :class:`_schema.Table`, but also mapped classes or
    :class:`.AliasedClass` instances.   The "on" clause can
    be a SQL expression, or an attribute or string name
    referencing a configured :func:`_orm.relationship`.

    :func:`_orm.join` is not commonly needed in modern usage,
    as its functionality is encapsulated within that of the
    :meth:`_query.Query.join` method, which features a
    significant amount of automation beyond :func:`_orm.join`
    by itself.  Explicit usage of :func:`_orm.join`
    with :class:`_query.Query` involves usage of the
    :meth:`_query.Query.select_from` method, as in::

        from sqlalchemy.orm import join
        session.query(User).\
            select_from(join(User, Address, User.addresses)).\
            filter(Address.email_address=='foo@bar.com')

    In modern SQLAlchemy the above join can be written more
    succinctly as::

        session.query(User).\
                join(User.addresses).\
                filter(Address.email_address=='foo@bar.com')

    See :meth:`_query.Query.join` for information on modern usage
    of ORM level joins.

    .. deprecated:: 0.8

        the ``join_to_left`` parameter is deprecated, and will be removed
        in a future release.  The parameter has no effect.