Isn't this the very thing that the session / UOW constructs are supposed to address for case #1?
This can all break in a web application that doesn't want to maintain any in-memory state at all -- for those you can serialize via pickle/JSON/whatever the objects being manipulated and hold them in persisent sessions or stashed in the database. When things are as you like them, a single flush() in a transaction. The optimistic versioning in SA works for protection against other updates. Rick On 5/23/07, svilen <[EMAIL PROTECTED]> wrote: > > > howdy. > here the use case. > i have object Parent, which has relation to many objects Child. > > so, in UI, i have dialog editor for the Parent object, which has some > direct attributes (name, age, etc), and some list of Children. > Adding a Child to the list, or editing attributes of existing child, > is done in another (dialog) sub-editor. So there are 2 nested user > transactions here - adding/editing a Child, and changing Parent's > data. > There are 2 possible way to go: > - nested, i.e. cancelling parent's editor cancels any changes to > parent including adding or editing children data. As result, cancel > of parent editor means no changes whatsoever > - no nesting, i.e. confirming Child editor saves the child-data and > attaches child to parent, and cancelling the Parent editor would not > undo any of these. As result, cancel of parent editor means no > changes of parent attributes but all changes in relations remain > - partial no nesting, when cancelling parent results in child data > remain changed, but parent's relation is not changed > > There are cases when no-nesting/partial-no-nesting is preferred way, > but there are cases when nesting is required. > > add on top of this versioning/bitemporalism and things get tough... > > Any ideas/patterns how to transfer this nesting-of-user-transactions > into DB / alchemy? > > > ciao > svil > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---