On Dec 8, 2011, at 4:55 PM, Michael Hipp wrote:

> I'm getting a dirty indication on a particular ORM object from 
> session.is_modified(rec, passive=True) and also that same rec shows up in 
> session.dirty. But I can't figure out where/how it's been modified. Is there 
> some way to determine up which columns are dirty?

assuming you're not using any old style "mutable" attributes, a debugging 
technique you can use immediately is to look in committed_state:

from sqlalchemy.orm.attributes import instance_state

instance_state(myobject).committed_state

this dictionary shows you what was loaded from the database that's been 
replaced with something new.   This isn't totally public API right now but it 
is expedient.

The more "legit" way is to use attributes.get_history() on each individual 
attribute.

One day when we totally no longer have "mutable" attributes, we may be able to 
make "committed_state" more of a public system.


-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to