This did not end up working as, I think, active_history is by default
false.  Is there a way in a mapper to set this for all attributes to
be True?  Its a shame as any AttributeExtension will fix this as they
imply True.


On Feb 18, 3:23 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
> get_history() is a public function within the attributes package at  
> the top level, and I also added API documentation for it recently (not  
> on the site yet).
>
> from sqlalchemy.orm.attributes import get_history, instance_state
>
> get_history(instance_state(myobject), "someattribute")
>
> in the latest trunk you can pass "myobject" straight to get_history  
> without using instance_state.
>
> session.is_modified() just calls get_history() on every attribute, so  
> you might want to consider just looping through the attributes the way  
> is_modfied() does and do your history operation inline.
>
> On Feb 18, 2009, at 9:43 AM, kindly wrote:
>
>
>
> > Hello
>
> > I intend to log any changes (not new rows) to a table.
>
> > The simplist way I can see to do this is to check every object that is
> > "add"ed for changes.  I intend to, before every flush, look in "dirty"
> > then use is_modified and if there is a change use get_history to find
> > out the original and new attribute values.  I am wary of doing it this
> > way as _sa_instance_state looks private even though get_history is
> > not.  Should this be safe to use?  Or is there a better way?
>
> > Thanks
>
> > David
--~--~---------~--~----~------------~-------~--~----~
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