I run a program which creates, fills and merges to DB a list of mapped 
objects. I need to know if a merge created a new instance in a database or 
if it updated previously existing one or if it did noop. When I know the 
instance is persistent, my goal is to figure out if it's going to be 
updated after COMMIT. 
I use 
session.is_modified(object)
for that.
If the first object in the list is truly not modified, this function 
correctly reports False. But for the next objects it returns True and 
blames one of the relationship attributes. 
As it turns out, for the first object state.committed_state includes the 
actual value of the relationship attribute - related object, while for the 
others it is 
symbol(PASSIVE_NO_DELETE)
and so the current value of the relationship is wrongly considered "added".

Does anyone know why it happens like this? How can I correctly check if the 
object's going to be updated on commit?

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to