On Monday, February 11, 2013 5:00:50 PM UTC-6, Michael Bayer wrote: > > > should be easy enough to create those joins automatically using the > relationship: > > query(School.id, > func.count(Coordinator.id)).join(School.coordinators).group_by(School.id).having(func.count(Coordinator.id) > > > 1) > > > or you could join() explicitly with a separate target/ON clause, shouldn't > be necessary though.
Thanks for your reply Mike. I tried exactly that but I get: AttributeError: type object 'School' has no attribute 'coordinators' So I went ahead and got rid of the backref from the relationship defined in Coordinator and explicitly added the "coordinators" relationship on School and now it works. Worth a ticket? -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.