> > without saving, so flushes occur only at the user's request. 
> > It's not clear to me how one could easily discard the session and
> > create a new one in this context.  Doing so would probably
> > involve keeping track of all the unsaved changes myself, which
> > would be throwing away much of the value of the session object.
>
> the changed state on your objects is stored in an attribute on the
> object itself called "_state" (and actually, its not the "changes"
> as much as "what was loaded from the database").  you can freely
> move instances from one session to the next (using either
> save_or_update() or merge()) and the changes will be maintained.

u mean, the changes as such are kept in the object itself, but the 
obj._state knows if it is modified and keeps the original 
loaded-from-db-state of the object?

And trans.rollback() or session.clear()/detach will not revert.undo 
any changes i've done?
e.g.

assert obj.name == 'kuku'

t = transaction()
try:
 obj.name = 'pipe'
 t.commit()
except:
 t.rollback()
assert obj.name == pipe
print obj._state

will pass with and without error?

If this is the case, then, hmm, huge misunderstanding; maybe the SA 
documentaion has to be changed. 3 ppl here read it and left with the 
opinion that SA will restore obj' attributes to whatever they were 
before starting the session/transaction.
And of course, noone tried it ;-)

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to