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 »

Fonction nulls_last - module sqlalchemy

Signature de la fonction nulls_last

def nulls_last(column) 

Description

nulls_last.__doc__

Produce the ``NULLS LAST`` modifier for an ``ORDER BY`` expression.

        :func:`.nulls_last` is intended to modify the expression produced
        by :func:`.asc` or :func:`.desc`, and indicates how NULL values
        should be handled when they are encountered during ordering::


            from sqlalchemy import desc, nulls_last

            stmt = select(users_table).order_by(
                nulls_last(desc(users_table.c.name)))

        The SQL expression from the above would resemble::

            SELECT id, name FROM user ORDER BY name DESC NULLS LAST

        Like :func:`.asc` and :func:`.desc`, :func:`.nulls_last` is typically
        invoked from the column expression itself using
        :meth:`_expression.ColumnElement.nulls_last`,
        rather than as its standalone
        function version, as in::

            stmt = select(users_table).order_by(
                users_table.c.name.desc().nulls_last())

        .. versionchanged:: 1.4 :func:`.nulls_last` is renamed from
            :func:`.nullslast` in previous releases.
            The previous name remains available for backwards compatibility.

        .. seealso::

            :func:`.asc`

            :func:`.desc`

            :func:`.nulls_first`

            :meth:`_expression.Select.order_by`