On Dec 8, 2006, at 1:30 PM, Michael Bayer wrote:
>
> the reason that get_history calls attribute_manager.get_history is
> because all awareness of "attribute history" is handled by the
> attribute module.  the reason attribute_manager then calls the
> InstrumentedAttribute off of the class is because thats where
> AttributeManager reprents the behavior for a specific class attribute.
> ColumnProperty knows nothing about InstrumentedAttribute.

Hmm...I guess ColumnProperty is not really what I'm looking for then-- 
it looks more like a layer between user code and the attribute  
manager. I want to be able to control the communication between the  
attribute manager and the mapped object. Currently AttributeManager  
and friends just access object.__dict__ directly, which means I can't  
get between them...too bad.

I guess what I'm really looking to customize is  
InstrumentedAttribute, which is even more formidable than  
ColumnProperty. Is there an easy way to tell SA to use a custom  
InstrumentedAttribute class?

>
> if you look at the constructor for InstrumentedAttribute itself, youll
> see it takes two callables which provide the "compare" function and  
> the
> "copy" function.  these are provided by the TypeEngine object via the
> ColumnLoader, which is off the ColumnProperty.  So i would propose  
> that
> these two arguments become optional keyword arguments to  
> ColumnProperty
> which ColumnLoader/DeferredLoader pick up on and send to their
> init_class_attribute method, so that you can send in whatever compare
> and copy callables you want.

I'm not sure if that would actually solve my problem since compare  
and copy do not allow me to mutate the data as it passes from SA to  
the object. Could we create a mapper extension point that would get  
called to check if an object is modified? It would need be hooked  
into the logic inside locate_dirty(). That would allow me to do this  
whole thing with a mapper extension.

~ Daniel

--~--~---------~--~----~------------~-------~--~----~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to