I have three tables that are structured somewhat like this: Document * id * all_images = sa.orm.relationship(Document2Image)
Image * id * all_documents = sa.orm.relationship(Document2Image) Document2Image * id * document_id * image_id * image_type_id * document = sa.orm.relationship(Document) * image = sa.orm.relationship(Image) is there a convenient way to set up a relationship on Document where it maps to Document2Image with a specific Document2Image.image_type_id ? I believe I want a variant of the Association Proxy [ http://docs.sqlalchemy.org/en/rel_0_8/orm/extensions/associationproxy.html ] that was listed in Relationships - Association Object [ http://docs.sqlalchemy.org/en/rel_0_8/orm/relationships.html#association-object ] I just can't wrap my head around this. What I'd like to have is something like : Document * id * all_images = sa.orm.relationship(Document2Image) * header_image = sa.orm.relationship( Image , filter( Image.image_type_id == 1 , Image.id == Document2Image.image_id , Document2Image.document_id == Document.id ) this way i can just write out : document.header_image and either see 'None' or the 'Image' object. if it matters, i'm only concerned with reads right now. -- 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.