hey kevin - sorry i didnt get around to answering this....its because yeah, what you have below is more or less how that can be done right now, only because a nicer interface hasnt been implemented yet.
heres another way to do it: for obj in session.dirty: history = obj._attribute_manager.attribute_history(obj) for key, value in history.iteritems(): hist = value.history(passive=True) # handles LazyLoaders, 'passive' means dont execute them added = hist.added_items() deleted = hist.deleted_items() if len(added) or len(deleted): print "Changed: ", key, " Added:", added, " Deleted:", deleted We can make whatever interface we want for this...feel free to suggest. On Jun 7, 2006, at 10:47 AM, Kevin Deenanauth wrote: > Kevin Deenanauth <kdeenanauth <at> pegasys.cc> writes: > >> >> >> This code: >> >> session = objectstore.get_session() >> print session.dirty >> >> ...gives me a list of what objects are going to be updated. How >> do I find out >> what exact attributes changed? >> >> Thanks for Sqlalchemy! I came from the SQLObjects side and this >> stuff is much >> more robust >> -Kevin >> > > > I've found one solution: > session = objectstore.get_session() > > for obj in session.dirty: > for col in obj.mapper.table.columns: > prop = obj.mapper._getpropbycolumn(col, False) > if prop is None: > continue > history = prop.get_history(obj, passive=True) > a = history.added_items() > if len(a): > print 'changed:',type(prop),prop.key,a > > It does feel hackish, but it works. If anyone knows a better > solution, let me > know! =) > > > > > _______________________________________________ > Sqlalchemy-users mailing list > Sqlalchemy-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users