summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/elements.py
diff options
context:
space:
mode:
authorIlja Everilä <saarni@gmail.com>2014-09-11 15:39:56 +0300
committerIlja Everilä <saarni@gmail.com>2014-09-11 15:39:56 +0300
commit52a095ba6675f5f5807a1dc655b4ae32b9999f27 (patch)
tree88a3592ea51dbca2e438b720ca303050d9c14d54 /lib/sqlalchemy/sql/elements.py
parentab1c25266dd49f087b5fff316b6ba6fb610b1d35 (diff)
downloadsqlalchemy-52a095ba6675f5f5807a1dc655b4ae32b9999f27.tar.gz
allow windowing filtered functions
Diffstat (limited to 'lib/sqlalchemy/sql/elements.py')
-rw-r--r--lib/sqlalchemy/sql/elements.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py
index 5ac16ab7a..62fe6553a 100644
--- a/lib/sqlalchemy/sql/elements.py
+++ b/lib/sqlalchemy/sql/elements.py
@@ -2931,6 +2931,26 @@ class FunctionFilter(ColumnElement):
return self
+ def over(self, partition_by=None, order_by=None):
+ """Produce an OVER clause against this filtered function.
+
+ Used against aggregate or so-called "window" functions,
+ for database backends that support window functions.
+
+ The expression::
+
+ func.rank().filter(MyClass.y > 5).over(order_by='x')
+
+ is shorthand for::
+
+ from sqlalchemy import over, funcfilter
+ over(funcfilter(func.rank(), MyClass.y > 5), order_by='x')
+
+ See :func:`~.expression.over` for a full description.
+
+ """
+ return Over(self, partition_by=partition_by, order_by=order_by)
+
@util.memoized_property
def type(self):
return self.func.type