Re: [sqlalchemy] group_concat, op and separator

2012-07-22 Thread Michael Bayer
that is a bug and here is a workaround: from sqlalchemy.sql import column, func, literal_column # work around [ticket:2537] until SQLAlchemy 0.8 from sqlalchemy.sql import operators operators._PRECEDENCE['SEPARATOR'] = 0 expr = func.group_concat(column('urlname').op('SEPARATOR')(literal_column('

[sqlalchemy] group_concat, op and separator

2012-07-22 Thread Sergey Kucheryavski
I try to use group_concat with SEPARATOR option as it was proposed in other topic but got a strange issue with using group_concat and op: this expression: print node.urlname.op('SEPARATOR')('/') gives node.urlname SEPARATOR :urlname_1 But this expression print func.group_concat(node.urlname.op('

Re: [sqlalchemy] Complex queries and pseudo fields

2012-07-22 Thread Sergey Kucheryavski
Well it works properly, thanks once again! On Sunday, July 22, 2012 9:01:29 AM UTC+2, Sergey Kucheryavski wrote: > > Then I perhaps did not understand how to use column_property correctly. I > mean one can do this: > > n2 = aliased(Node) > sel = select([group_concat(...)]).where(n2.lft <= Node.l

Re: [sqlalchemy] Complex queries and pseudo fields

2012-07-22 Thread Sergey Kucheryavski
Then I perhaps did not understand how to use column_property correctly. I mean one can do this: n2 = aliased(Node) sel = select([group_concat(...)]).where(n2.lft <= Node.lft).where(n2.rgt >= Node.rgt).order_by(n2.lft).label('url') Node.url = column_property(sel) only when a class is defined, af