From 1ad2647d2869226fc2f441de4c4e4984806231e0 Mon Sep 17 00:00:00 2001 From: Antti Haapala Date: Thu, 8 Jan 2015 14:32:08 +0200 Subject: Support for the WITHIN GROUP (ORDER BY) clauses (within_group/WithinGroup). --- lib/sqlalchemy/sql/compiler.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/sqlalchemy/sql/compiler.py') diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index ca14c9371..26d35a207 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -747,6 +747,12 @@ class SQLCompiler(Compiled): ) ) + def visit_within_group(self, within_group, **kwargs): + return "%s WITHIN GROUP (ORDER BY %s)" % ( + within_group.func._compiler_dispatch(self, **kwargs), + within_group.order_by._compiler_dispatch(self, **kwargs) + ) + def visit_funcfilter(self, funcfilter, **kwargs): return "%s FILTER (WHERE %s)" % ( funcfilter.func._compiler_dispatch(self, **kwargs), -- cgit v1.2.1