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 ? Programmation Python
Les fondamentaux
Voir le programme détaillé
Classe « Select »

Méthode sqlalchemy.Select.distinct

Signature de la méthode distinct

def distinct(self, *expr: '_ColumnExpressionArgument[Any]') -> 'Self' 

Description

help(Select.distinct)

Return a new :func:`_expression.select` construct which
will apply DISTINCT to the SELECT statement overall.

E.g.::

    from sqlalchemy import select

    stmt = select(users_table.c.id, users_table.c.name).distinct()

The above would produce an statement resembling:

.. sourcecode:: sql

    SELECT DISTINCT user.id, user.name FROM user

The method also accepts an ``*expr`` parameter which produces the
PostgreSQL dialect-specific ``DISTINCT ON`` expression.  Using this
parameter on other backends which don't support this syntax will
raise an error.

:param \*expr: optional column expressions.  When present,
 the PostgreSQL dialect will render a ``DISTINCT ON (<expressions>)``
 construct.  A deprecation warning and/or :class:`_exc.CompileError`
 will be raised on other backends.

 .. deprecated:: 1.4 Using \*expr in other dialects is deprecated
    and will raise :class:`_exc.CompileError` in a future version.



Vous êtes un professionnel et vous avez besoin d'une formation ? Machine Learning
avec Scikit-Learn
Voir le programme détaillé