fixed in tip.

I'm a little uncertain that the fix might hit some other cases that aren't 
handled yet, if you get any errors about .name or .key with more complex 
expressions let me know.



On Sep 1, 2012, at 4:44 PM, Eric Lemoine wrote:

> Hi
> 
> I use 0.8's column_expression. Like this:
> 
> -----
> from sqlalchemy.types import UserDefinedType
> from sqlalchemy.sql import func
> 
> 
> class Geometry(UserDefinedType):
> 
>    def column_expression(self, col):
>        return func.ST_AsBinary(col, type_=self)
> 
> 
> from sqlalchemy import Table, Column, MetaData
> 
> lakes = Table('lake', MetaData(),
>    Column('geom', Geometry)
>    )
> 
> from sqlalchemy.sql import select
> s = select([lakes])
> print s
> ----
> 
> The final print statement returns this: "SELECT ST_AsBinary(lake.geom)
> AS geom_1  FROM lake".
> 
> My issue is with the "geom_1" label being generated. My column name
> being "geom" I'd expect the following to work:
> 
> s = select([lakes])
> for row in conn.execute(s):
>   geom = row['geom']
> 
> but it won't work because "row" does not have a "geom" item.
> 
> Is there a solution to this issue?




> 
> Thanks,
> 
> -- 
> Eric Lemoine
> 
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
> 
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemo...@camptocamp.com
> http://www.camptocamp.com
> 
> -- 
> 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.
> 

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