On Aug 3, 2009, at 5:21 PM, Hollister wrote:
> > I have 2 tables which are related to each other through an M:N > relationship (Keyword & Action). Additionally, the relationship itself > has attributes, which I have as non-key attributes in a third table > (KeywordAction). I've modeled this dozens of different ways, but have > yet to get exactly what I want from the model. > > At the ORM level, I want Keyword to have a property that is a > collection of KeywordAction instances. Each KeywordAction instance > would have a single Action instance property, so I could do things > like this: > > ----------------------------------------------------------------------------------------------------------- > for ka in keyword.keyword_actions: > if ka.status == 'open': > ka.action.do_something() > > keyword.keyword_actions.append(KeywordAction(action, status = 'open')) > ----------------------------------------------------------------------------------------------------------- > > I've tried using the association_proxy, but I get the feeling that's > not the right tool for this job. the above example doesn't seem like it would need association proxy, a simple collection of relation()s, i.e. Keyword.keyword_actions, KeywordAction.action would do based on the navigation illustrated. --~--~---------~--~----~------------~-------~--~----~ 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 sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---