Re: [Sqlalchemy-tickets] [sqlalchemy] #1844: support for postgresql windowing functions
Brought to you by:
zzzeek
From: sqlalchemy <mi...@zz...> - 2010-07-06 21:31:22
|
#1844: support for postgresql windowing functions -------------------------+-------------------------------------------------- Reporter: guest | Owner: zzzeek Type: enhancement | Status: new Priority: low | Milestone: 0.6.xx Component: postgres | Severity: major - 1-3 hours Keywords: | Status_field: awaiting triage -------------------------+-------------------------------------------------- Comment(by guest): This seems like part of the way there: {{{ from sqlalchemy.ext.compiler import compiles from sqlalchemy.sql.expression import Executable, ClauseElement, ClauseList, _generative from sqlalchemy import util class Over(Executable, ClauseList): def __init__(self, *column_or_columns): ClauseList.__init__(self,*util.to_list(column_or_columns) or []) self.over_clause = ClauseList(*util.to_list(column_or_columns) or []) @compiles(Over) def visit_over(grouping, compiler, asfrom=False, **kwargs): return "OVER (PARTITION BY " + compiler.process(grouping.over_clause, **kwargs) + ")" }}} Gregg L. -- Ticket URL: <http://www.sqlalchemy.org/trac/ticket/1844#comment:2> sqlalchemy <http://www.sqlalchemy.org/> The Database Toolkit for Python |