Hello, I'm a little lost for selecting items from a many-to-many relationship.
I was able to find items from a one-to-many relation where I could find "sites" from one "client": OR = [model.Site.c[col].like(pattern) for col in model.Site.c.keys() if not (model.Site.c[col].primary_key or model.Site.c[col].foreign_key)] c.site_list = model.Site.select(and_( model.Site.c.id_client==c.client.id, or_(*OR), ) ) This works just fine. Now I have "clients" and "attachments" with a many-to-many relation. attachment_mapper = assign_mapper(ctx, Attachment, attachment_table, properties={ 'file':deferred(attachment_table.c.file), 'clients':relation(Client, backref=backref("attachments", order_by=attachment_table.c.name), secondary=attachments_has_clients, cascade="save-update"), }, ) And I'd like to find all "attachments" from one client. But as there's a weak (secondary) table in between, I can no longer have something like: model.Attachment.id_client==c.client.id How can I achieve this ? ps: I'm using assign_mapper. Regards, -- Alexandre CONRAD --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---