Those methods aren't part of the contract at the moment but I can add them in.


On Sep 4, 2012, at 10:30 AM, Eric Lemoine wrote:

> Hi
> 
> I'm trying to add __lshift__ and __rshift__ to my (now well known :)
> Geometry's comparator_factory, but it looks like SQLAlchemy isn't
> happy with it.
> 
> 
> 
> ----
> from sqlalchemy.types import UserDefinedType
> 
> 
> class Geometry(UserDefinedType):
> 
>    class comparator_factory(UserDefinedType.Comparator):
> 
>        def __lshift__(self, other):
>            return self.op('<<')(other)
> 
>        def __rshift__(self, other):
>            return self.op('>>')(other)
> 
> 
> from sqlalchemy import Table, Column, MetaData
> 
> lakes = Table('lake', MetaData(),
>    Column('geom', Geometry)
>    )
> 
> to_left_expr = lakes.c.geom << 'POINT(1 2)'
> to_right_expr = lakes.c.geom >> 'POINT(1 2)'
> ----
> 
> 
> 
> This is the traceback:
> 
> Traceback (most recent call last):
>  File "comparator_factory.py", line 21, in <module>
>    to_left_expr = lakes.c.geom << 'POINT(1 2)'
> TypeError: unsupported operand type(s) for <<: 'Column' and 'str'
> 
> 
> Is it me doing something wrong, or is SQLAlchemy just not dealing with
> << and >> for the moment? FYI, __add__ works just fine.
> 
> 
> Thank you.
> 
> 
> -- 
> 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