Hello,
I should have expected refresh() to have problem with dirty objects, but if
it isn't a bug, maybe it should be at least documented.
To explain whole situation and why do I call the refresh() at all: I have
Account persistent class, with balance property. When doing processing, I'm
locking the row whenever it is necessary to update it (to not lock more
rows than necessary), like:
def update(acct,...):
DBSession.refresh(acct,lockmode='update')
#update balance, add transaction record,return
The problem is, this function can be called multiple times in one session
and subsequent refresh calls throw out unsaved changes. So far I have fixed
it by placing DBSession.flush() calls. But calling flush() in the middle of
processing implies risk of problems with unmatched constraints (not fully
fleshed out data). Another idea is to mark already locked objects so that
refresh() is called only first time in a transaction. Such reentrant
behavior may be useful to have, what do you think?
Thanks,
Juraj
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.