[sqlalchemy] Re: Advice on modeling a many-to-many relationship

2009-08-06 Thread Hollister
Still having a little trouble...here are the relevant mappings: orm.mapper(Keyphrase, keyphrase_table, properties = { 'message':orm.relation(Message, backref='keyphrase'), 'campaign':orm.relation(Campaign, backref='keyphrase'), 'actions':orm.relation(KeyphraseAction),

[sqlalchemy] Re: Advice on modeling a many-to-many relationship

2009-08-06 Thread Hollister
Also, the following does nothing at all (does not delete and throws no errors): for ka in kp.actions: del ka But this: del kp.actions Throws the same assertion error. On Aug 6, 11:01 am, Hollister a.hollister.willi...@gmail.com wrote: Still having a little trouble...here

[sqlalchemy] Re: Advice on modeling a many-to-many relationship

2009-08-06 Thread Michael Bayer
you're probably looking for delete-orphan cascade in this case, if objects have foreign keys on their primary key columns you'd like them to be deleted when deassociated with their parent object. Hollister wrote: Also, the following does nothing at all (does not delete and throws no errors):

[sqlalchemy] Re: Advice on modeling a many-to-many relationship

2009-08-05 Thread Hollister
That was exactly the conclusion I reached before I read your reply. I modeled it that way and it seems to work perfectly. Guess I was just overthinking it. Thanks for getting back to me, Mike. On Aug 3, 11:41 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Aug 3, 2009, at 5:21 PM,

[sqlalchemy] Re: Advice on modeling a many-to-many relationship

2009-08-03 Thread Michael Bayer
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