On Jan 23, 2009, at 1:43 PM, Toby Bradshaw wrote:

> But what happens (if you add a few prints and whatnot to illustrate)  
> is
> that the property setter is never called either when objects are being
> instanced from the database or when setting the property of an  
> existing
> instance of B. Seems that the reflection mechanism has hijacked (via
> it's own descriptors I'm imagining) attribute access in a way that  
> makes
> it impossible for this kind of symmetrical translation to occur.
>
> I would have thought this might be a relatively common problem with
> legacy databases so I'd thought check with the list to see if a  
> solution
> or workaround had already been found. Couldn't find an obvious  
> parallel
> in the list archives so I'm appealing to the group memory for some  
> help
> on this.
>
> Am I just getting this wrong or have I just come against something  
> that
> just can't currently be done ? I can thing of alternative schemes that
> might work but they seem to lose me the ability to use the synonym as
> spelled in filter expressions



the synonym() construct and the mapped attribute it creates represents  
a proxy to the mapped column only in the context of accessing and  
setting values within the python application space.  It is not invoked  
when the database populates the value of the mapped column itself.     
the general idea of synonym is that the column-based information stays  
represented on the mapped instance in the identical manner that it  
does within the database, and the synonym-based attribute interprets  
application-level values into the column representation.

it should definitely be invoked when setting the property of an  
existing instance of B, so if that's not working you can share with us  
exactly how you are configuring things, since you might be missing  
some detail.

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