On Mar 9, 2011, at 3:10 PM, Yang Zhang wrote:

> 
> Also, when using mutable=False, is there a way to manually mark the
> field dirty, without creating a new copy of the value with a different
> id?

0.7 has a function flag_modified() for this purpose, which is what the mutable 
events extension uses.   It's not backported to 0.6 right now though it might 
work as is:


from sqlalchemy.orm.attributes import instance_state, instance_dict, NO_VALUE
def flag_modified(instance, key):
    state, dict_ = instance_state(instance), instance_dict(instance)
    impl = state.manager[key].impl
    state.modified_event(dict_, impl, NO_VALUE)



> 
> -- 
> Yang Zhang
> http://yz.mit.edu/

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