>From my study of the documentation, it seems to be the case that the state 
of "pending" refers to the set of instances that is the sum of both 
session.new and session.dirty. Is this understanding correct?

In addition, using session.add() will almost always lead to a new item in 
session.new, while using session.merge() will almost always lead to a new 
item in session.dirty. For example, if I have an instance named p.

If I use session.add(p):
>>>session.add(p)
>>>session.new
IdentitySet(([<__main__.P object at 0xb69fbc0c>])
>>>session.dirty
IdentitySet([])

If I use session.merge(p):
>>>session.merge(p)
>>>session.new
IdentitySet([])
>>>session.dirty
IdentitySet(([<__main__.P object at 0xb69fbc0c>])


So, the conclusion is: 
session.add ==> a new item added to session.new
session.merge ==> a new item added to session.dirty
session.add + session.merge ==> "pending"

Is my conclusion correct?

-- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to