On Jul 7, 2008, at 5:46 PM, Eric Lemoine wrote:

>> without synonym(), just add "_email:addresses_table.c.email" to your
>> mapper properties dict so that the "email" name is made available.
>
> In that case, on DB read, SA will set _email directly and won't go
> through _set_email(). Is that correct?

yes.

> And with "email:synonym('_email', map_column=True)", will SA set
> _email directly or will it go through _set_email()? My feeling is that
> it will set it directly, so it is exactly the same as doing
> "_email:addresses_table.c.email".

the mapper will always set _email directly.  It never goes through  
user-defined descriptors since it is essentially writing to  
obj.__dict__ directly.

If you want Python code to take effect for data as it leaves the  
database, you might look into creating a TypeDecorator with the  
desired behavior.

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