Re: [sqlalchemy] many-to-one relationship with intermediate table & non equijoin

2013-08-16 Thread Michael Bayer
surprising to see someone actually use corresponding_column. At the moment this is likely closest to the simplest way with relationship(). On Aug 14, 2013, at 10:03 PM, avdd wrote: > Thanks for the quick response! > > After much fiddling I got it working using alias(), foreign() and > corre

Re: [sqlalchemy] many-to-one relationship with intermediate table & non equijoin

2013-08-14 Thread Michael Bayer
create a non primary mapper to a select() that's against the Enrolment table joined to RosterLine (i.e. mapper(myselect.alias(), non_primary=True), then construct a relationship() to that mapper (viewonly=True of course). at some point I should add an example of this technique, it's just the eas

[sqlalchemy] many-to-one relationship with intermediate table & non equijoin

2013-08-14 Thread avdd
Hello all Tried for hours to figure out the various relationship() options with no luck. Consider: class Enrolment(base): __tablename__ = 'enrolment' person_id = Column(String, primary_key=True) group_id= Column(String, primary_key=True) enrol_date = Column(Date, primary