On Tuesday 23 September 2008 16:06:07 Michael Bayer wrote: > On Sep 23, 2008, at 7:58 AM, [EMAIL PROTECTED] wrote: > > hi > > i cant get how to configure cascades over many-to-many relations. > > in my case these are implicit m2m (via secondary-table), being > > treated as either versioned one2many, or versioned many2one. > > > > lets say there is versioned A having many versioned Bs. > > (' and " denote version number): > > A1' has B1 which has versions: > > A1'.bs = [B1', B2'] > > (another timestamp) > > A1'.bs = [B1", B2'] > > A2 has versions which keep same B2, one has also B3: > > A2'.bs = [B2'] > > (another timestamp) > > A2".bs = [B2', B3'] > > > > deleting A1' should delete B1' and B1" > > deleting A2' should not delete B2'; only deleting all A2' and A2" > > and A1' should delete B2'. > > is this "all,delete-orphan" given to the A.relation(B) ? > > or only "delete-orphan"? > > how about backrefs (if any) > > delete-orphan pretty much needs delete to work correctly. but for > the many-to-many use case, I'm not sure if SQLA does "the right > thing" and cross references every relationship - these cascades > were designed more for the o2m direction (I think Hibernate > supports them only for o2m relations). I'd work up some simple > test cases to see what it has to say in this regard (it would have > to actively load in other objects to see if an object is truly an > "orphan", for example. not sure if its going to try that). so far i've used "all" and it seems to work for one single owner, but i havent really tried the multiple case. the whole thing seems to me like a splitted reference-counting mechanism, one side being weakref, other not.
--~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---