On 2011-12-08 4:11 PM, Michael Bayer wrote:
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.

That works swimmingly. And turns out it was telling the truth that something had been modified :-)

Thanks,
Michael

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