Ah works almost, it seems like the mapper gets the last in the list of all participants instead of the one I want.
Quoting Michael Bayer <[EMAIL PROTECTED]>: > there is !! its blank (almost) ! everyone go add something: > > http://www.sqlalchemy.org/trac/wiki/UsageRecipes > > > > On Mar 17, 2006, at 10:02 AM, Florian Boesch wrote: > > > Works like a charm the first try, thx a lot. Speaks for my variable- > > names then > > ;D. > > > > We should somewhere build a catalog of mapper patterns or something. > > > > Cheers, > > Florian > > > > Quoting Michael Bayer <[EMAIL PROTECTED]>: > > > >> these would be a lot easier if you gave me a conceptual overview > >> instead of my psychically reverse-engineering your classes from your > >> variable names, but here goes.... > >> > >> product_mapper = mapper(Product, products, properties = { > >> 'artist' : relation(participant_mapper, participant_activity, > >> primaryjoin=participant_activity.c.product_id==products.c.id, > >> secondaryjoin=and_( > >> participant_activity.c.activity_id==activity.c.id, > >> participant_activity.c.participant_id==participant.c.id, > >> activity.c.name=='artist' > >> ), > >> uselist=False > >> ) > >> }) > >> > >> > >> what will be interesting to see will be if the relation manages to > >> pull in the "activity" table into the SQL correctly (i dont see why > >> it wouldnt but I havent tested this scenario yet). > >> > >> On Mar 16, 2006, at 11:38 AM, Florian Boesch wrote: > >> > >>> In short, I want to do a proper relation definition for that > >>> > >>> @property > >>> def artist(self): > >>> on_act_val = activity.c.name == 'artist' > >>> on_track = participant_activity.c.product_id == self.id > >>> on_act_join = participant_activity.c.activity_id == > >>> activity.c.id > >>> on_part_join = participant_activity.c.participant_id == > >>> participant.c.id > >>> return participants.selectone(on_track & on_act_join & > >>> on_part_join & > >>> on_act_val) > >>> > >>> any idea? > >>> > >>> > >>> ------------------------------------------------------- > >>> This SF.Net email is sponsored by xPML, a groundbreaking scripting > >>> language > >>> that extends applications into web and mobile media. Attend the > >>> live webcast > >>> and join the prime developer group breaking into this new coding > >>> territory! > >>> http://sel.as-us.falkag.net/sel? > >>> cmd=lnk&kid=110944&bid=241720&dat=121642 > >>> _______________________________________________ > >>> Sqlalchemy-users mailing list > >>> Sqlalchemy-users@lists.sourceforge.net > >>> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users > >> > >> > >> > >> ------------------------------------------------------- > >> This SF.Net email is sponsored by xPML, a groundbreaking scripting > >> language > >> that extends applications into web and mobile media. Attend the > >> live webcast > >> and join the prime developer group breaking into this new coding > >> territory! > >> http://sel.as-us.falkag.net/sel? > >> cmd=lnk&kid=110944&bid=241720&dat=121642 > >> _______________________________________________ > >> Sqlalchemy-users mailing list > >> Sqlalchemy-users@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users > >> > >> > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by xPML, a groundbreaking scripting > > language > > that extends applications into web and mobile media. Attend the > > live webcast > > and join the prime developer group breaking into this new coding > > territory! > > http://sel.as-us.falkag.net/sel? > > cmd=lnk&kid=110944&bid=241720&dat=121642 > > _______________________________________________ > > Sqlalchemy-users mailing list > > Sqlalchemy-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users > > ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users