I see a note in a change log that this is possible. I've got the following SQLA code:
ors = [] ors.append(func.lower(pwEntries.uname).like("%%jeff%%")) ors.append(func.lower(pwEntries.gcos).like("%%jeff%%")) print pwEntries.query().filter( or_(*ors) ).order_by(func.lower(pwEntries.eid).desc()).order_by(pwEntries.uname).compile() And it generates the following query: SELECT pw_entries.domain_id AS pw_entries_domain_id, pw_entries.domain_name AS pw_entries_domain_name, pw_entries.nis_account_id AS pw_entries_nis_account_id, pw_entries.uid AS pw_entries_uid, pw_entries.eid AS pw_entries_eid, pw_entries.uname AS pw_entries_uname, pw_entries.gid AS pw_entries_gid, pw_entries.gcos AS pw_entries_gcos, pw_entries.home AS pw_entries_home, pw_entries.shell AS pw_entries_shell, pw_entries.canonical AS pw_entries_canonical, pw_entries.vendor AS pw_entries_vendor, pw_entries.reserved AS pw_entries_reserved, pw_entries.expires AS pw_entries_expires, pw_entries.terminated AS pw_entries_terminated FROM pw_entries WHERE lower(pw_entries.uname) LIKE %(lower_1)s OR lower(pw_entries.gcos) LIKE %(lower_2)s ORDER BY lower(pw_entries.eid) DESC, pw_entries.uname Which is good. I'd like the select to be modified to have a "DISTINCT ON (pw_entries.eid, pw_entries.uname, pw_entries.uid)" before the rest of the columns, something like this: SELECT DISTINCT ON (pw_entries.eid, pw_entries.uname, pw_entries.uid) pw_entries.domain_id AS pw_entries_domain_id, I've tried adding a distinct() call with an array argument, that didn't work. I've also tried putting a select(distinct=[..]) call in the chain with no luck. Any advice/guidance is very much appreciated. Thanks, Jeff. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---