allow .distinct() to specify a column for DISTINCT ON #808
Replies: 2 comments 9 replies
-
This would be a nice feature. Looking at the docs it seems like the column specified in the So in this example, SELECT DISTINCT ON (location) location, time, report
FROM weather_reports
ORDER BY location, time DESC; This might be why Feel free to open a PR if you want - doesn't have to be perfect. |
Beta Was this translation helpful? Give feedback.
-
@williamflaherty We've made some progress on this: #813 I know you already did some thinking about it, so would appreciate your thoughts on the current solution. I've sent you an invite with the |
Beta Was this translation helpful? Give feedback.
-
As the title says, would be great if you could specify a column in TableName.select().distinct() to handle distinct on or something similar?
I started poking around to add it myself but got stopped up by order_by needing to be in the same order issues from asyncpg. (I'm far from a PostgreSQL expert).
Beta Was this translation helpful? Give feedback.
All reactions