MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / distinct_on

Function distinct_on

lib/sqlalchemy/dialects/postgresql/ext.py:542–555  ·  view source on GitHub ↗

apply a DISTINCT_ON to a SELECT statement e.g.:: stmt = select(tbl).ext(distinct_on(t.c.some_col)) this supersedes the previous approach of using ``select(tbl).distinct(t.c.some_col))`` to apply a similar construct. .. versionadded:: 2.1

(*expr: _ColumnExpressionArgument[Any])

Source from the content-addressed store, hash-verified

540
541
542def distinct_on(*expr: _ColumnExpressionArgument[Any]) -> DistinctOnClause:
543 """apply a DISTINCT_ON to a SELECT statement
544
545 e.g.::
546
547 stmt = select(tbl).ext(distinct_on(t.c.some_col))
548
549 this supersedes the previous approach of using
550 ``select(tbl).distinct(t.c.some_col))`` to apply a similar construct.
551
552 .. versionadded:: 2.1
553
554 """
555 return DistinctOnClause(expr)
556
557
558class DistinctOnClause(SyntaxExtension, expression.ClauseElement):

Callers 4

goMethod · 0.90
propagate_casesMethod · 0.90

Calls 1

DistinctOnClauseClass · 0.85