a guaranteed stable way that doesn't rely on SQLAlchemy implementation details and is easy to understand is here. this is how I would do it:
http://pastebin.com/f6670eebe Joril wrote: > > Hi everyone! > I'm still working on implementing data logging with SQLAlchemy > (=whenever someone updates a persisted entity, generate a new record > and mark the old one as such) and I'm looking for help again :) > > Everything works fine, aside from many-to-many's.. For example, if I > save a parent object with 2 children, and then update it, every object > gets correctly replicated but the junction table doesn't get updated, > so the new parent record never gets linked to its children.. So, to > visualize: > > Having > > p1.children = [ c1, c2 ] > > after updating p1 I end up with > > p1.children = [ c1, c2 ] > p2.children = [] > with c3 and c4 "on the loose" :/ > > I've been debugging this for 6 hours *_*; But I can't figure out how > to trick SQLA into INSERTing the new relation inside the junction > table.. Is there a way? > I posted a simple testcase at http://pastebin.com/m16f5ef0a > > Many thanks for your attention! > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---