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 raiseload - module sqlalchemy.orm

Signature de la fonction raiseload

def raiseload(*keys, **kw) 

Description

raiseload.__doc__

Indicate that the given attribute should raise an error if accessed.

    A relationship attribute configured with :func:`_orm.raiseload` will
    raise an :exc:`~sqlalchemy.exc.InvalidRequestError` upon access.   The
    typical way this is useful is when an application is attempting to ensure
    that all relationship attributes that are accessed in a particular context
    would have been already loaded via eager loading.  Instead of having
    to read through SQL logs to ensure lazy loads aren't occurring, this
    strategy will cause them to raise immediately.

    :func:`_orm.raiseload` applies to :func:`_orm.relationship`
    attributes only.
    In order to apply raise-on-SQL behavior to a column-based attribute,
    use the :paramref:`.orm.defer.raiseload` parameter on the :func:`.defer`
    loader option.

    :param sql_only: if True, raise only if the lazy load would emit SQL, but
     not if it is only checking the identity map, or determining that the
     related value should just be None due to missing keys.  When False, the
     strategy will raise for all varieties of relationship loading.

    This function is part of the :class:`_orm.Load` interface and supports
    both method-chained and standalone operation.


    .. versionadded:: 1.1

    .. seealso::

        :ref:`loading_toplevel`

        :ref:`prevent_lazy_with_raiseload`

        :ref:`deferred_raiseload`