so I think the basic "SELECT DISTINCT ON(x) y, z, ..." is by sending an 
argument to the built-in distinct, not the standalone one, that is 
query.distinct(expr) or select.distinct(expr).

On Sep 21, 2013, at 10:26 PM, Jonathan Vanasco <jonat...@findmeon.com> wrote:

> 
> I can't seem to generate a "distinct on(column)" query ( .8 branch )
> 
> i'm using a connection with an ORM session , and working on an alias
> 
> this just creates a "SELECT DISTINCT column"
> 
>     sqlalchemy.select( 
> sqlalchemy.distinct(_slurped.c.object_id).label('object_id') , 
> _ordered.c.event_timestamp)
> 
> I looked in the source and tried this:
> 
>     sqlalchemy.select( 
> sqlalchemy.distinct((_slurped.c.object_id,)).label('object_id') , 
> _ordered.c.event_timestamp )
> 
> which creates:
> 
>     "SELECT DISTINCT %(param_1)s" 
>     'param_1': (Column('object_id', Integer(), ForeignKey('object.id'), 
> table=<slurped>, nullable=False),),
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/groups/opt_out.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to