On Aug 24, 2010, at 2:08 PM, Michael Hipp wrote: > I'm holding an orm object that will have changes made to it. Once done it > will be passed to the business logic layer that will have to make decisions > from the before and after state of the object... > > What's the best way to get an object, save its state ('before'), modify it > ('after) without any chance of the modifications creeping into the before? > Assume both copies are from the same session.
You'd probably call session.flush() (or commit(), depending on how you are scoping your transaction around this operation) before you do anything to it. Then, if you'd like the subsequent modifications to not go to the database at all until some later point, you'd proceed with your subsequent operations with autoflush turned off - recipes for that are at http://www.sqlalchemy.org/trac/wiki/UsageRecipes/DisableAutoflush . > > Thanks, > Michael > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalch...@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.