| When I added many-to-many to the ActiveMapper library I was expecting that associations could be accessed via one-to-many relationships. Try: class AccountPhonebookWeight(ActiveMapper): class mapping: account_id= column( Integer, foreign_key="cc_account.id", primary_key=True ) phonebook_id= column( Integer, foreign_key="cc_phonebook.id", primary_key=True) weight= column(Integer) phonebook= one_to_one( "Phonebook" ) and then in your Account object, add: phonebook_weights= one_to_many("AccountPhonebookWeight") You could then load an account object and access the weight and phonebook as such: account= Account.get_by( ... ) weight0= account.phonebook_weights[0].weight phonebook0= account.phonebook_weights[0].phonebook Of course you could add properties to Account to flatten out the AccountPhonebookWeight association. On 9 Mar, 2006, at 6:50 am, qvx wrote:
-- Jeff Watkins "Just because you have the right to do something, doesn't mean it's the right thing to do." -- Fred Friendly, former president of CBS News --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~----------~----~----~----~------~----~------~--~--- |
- [TurboGears] Re: SQLAlchemy: Many to Many join with extra col... Jeff Watkins

