This one time, at band camp, Michael Bayer wrote:
>heres something in rev 1718 you can try:
>
>from sqlalchemy import synonym
>
>mapper(PropertyClass, table,
>        properties = {
>         '_hash': table.c.hash,
>         'hash':synonym('_hash')
>         },
>        )
>
>results = session.query(PropertyClass).select_by(hash="a b")
>
>im a little antsy on this feature since its a whole new  
>MapperProperty which is literally used only by the select_by and  
>get_by functions...but it seems to be the clearest way to do it.   
>maybe synonym() will have other uses i havent realized yet.

You don't like select_by at all, do you :)

I'm also suspicious of it, but only because it now presents the same
attribute twice, which means you're exposing data; my original use case was
to hide the attribute behind accessor methods so that one couldn't set it;
with this now one can still subvert my access control and set the attribute
from the mapped object.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to