Great, thanks for the quick fix.

Found another minor bug with the window functions,
syntax should be
( partition by x order by y)
not
( partition by x, order by y)
... at least for postgresql.





On Apr 14, 8:51 pm, botz <randa...@gmail.com> wrote:
> Here's a quick example:
>
> the query form i'm aiming for is:
>
> select x - lag(x) over ( order by x ) from a;
>
> meta=MetaData()
> a = Table('a', meta, Column('x',Integer))
> print  select([ a.c.x ,  over( func.lag(a.c.x),  order_by =
> a.c.x )  ] )  # no problem
> print  select([ a.c.x -  over( func.lag(a.c.x),  order_by =
> a.c.x )  ] )  # this one fails to compile
>
> Here's the error:
>
>     print  select([ a.c.x -  over( func.lag(a.c.x),  order_by =
> a.c.x )  ] )
>   File "/usr/local/lib/python2.7/site-packages/SQLAlchemy-0.7b4dev-
> py2.7-linux-x86_64.egg/sqlalchemy/sql/expression.py", line 276, in
> select
>     **kwargs)
>   File "/usr/local/lib/python2.7/site-packages/SQLAlchemy-0.7b4dev-
> py2.7-linux-x86_64.egg/sqlalchemy/sql/expression.py", line 4317, in
> __init__
>     self._froms.update(_from_objects(*self._raw_columns))
>   File "/usr/local/lib/python2.7/site-packages/SQLAlchemy-0.7b4dev-
> py2.7-linux-x86_64.egg/sqlalchemy/sql/expression.py", line 1165, in
> _from_objects
>     return itertools.chain(*[element._from_objects for element in
> elements])
>   File "/usr/local/lib/python2.7/site-packages/SQLAlchemy-0.7b4dev-
> py2.7-linux-x86_64.egg/sqlalchemy/sql/expression.py", line 3265, in
> _from_objects
>     return self.left._from_objects + self.right._from_objects
> TypeError: can only concatenate list (not "itertools.chain") to list

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