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])
| 540 | |
| 541 | |
| 542 | def 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 | |
| 558 | class DistinctOnClause(SyntaxExtension, expression.ClauseElement): |