summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/__init__.py2
-rw-r--r--lib/sqlalchemy/sql/__init__.py2
-rw-r--r--lib/sqlalchemy/sql/compiler.py6
-rw-r--r--lib/sqlalchemy/sql/elements.py18
-rw-r--r--lib/sqlalchemy/sql/expression.py6
-rw-r--r--lib/sqlalchemy/sql/functions.py14
6 files changed, 24 insertions, 24 deletions
diff --git a/lib/sqlalchemy/__init__.py b/lib/sqlalchemy/__init__.py
index 1af0de3ba..d184e1fbf 100644
--- a/lib/sqlalchemy/__init__.py
+++ b/lib/sqlalchemy/__init__.py
@@ -7,7 +7,6 @@
from .sql import (
- aggregatefilter,
alias,
and_,
asc,
@@ -26,6 +25,7 @@ from .sql import (
extract,
false,
func,
+ funcfilter,
insert,
intersect,
intersect_all,
diff --git a/lib/sqlalchemy/sql/__init__.py b/lib/sqlalchemy/sql/__init__.py
index 8fbf1b536..351e08d0b 100644
--- a/lib/sqlalchemy/sql/__init__.py
+++ b/lib/sqlalchemy/sql/__init__.py
@@ -19,7 +19,6 @@ from .expression import (
Selectable,
TableClause,
Update,
- aggregatefilter,
alias,
and_,
asc,
@@ -39,6 +38,7 @@ from .expression import (
false,
False_,
func,
+ funcfilter,
insert,
intersect,
intersect_all,
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 6ebd61e9c..d59012d12 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -760,10 +760,10 @@ class SQLCompiler(Compiled):
)
)
- def visit_aggregatefilter(self, aggregatefilter, **kwargs):
+ def visit_funcfilter(self, funcfilter, **kwargs):
return "%s FILTER (WHERE %s)" % (
- aggregatefilter.func._compiler_dispatch(self, **kwargs),
- aggregatefilter.criterion._compiler_dispatch(self, **kwargs)
+ funcfilter.func._compiler_dispatch(self, **kwargs),
+ funcfilter.criterion._compiler_dispatch(self, **kwargs)
)
def visit_extract(self, extract, **kwargs):
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py
index 5562e80d7..5ac16ab7a 100644
--- a/lib/sqlalchemy/sql/elements.py
+++ b/lib/sqlalchemy/sql/elements.py
@@ -2888,28 +2888,28 @@ class Over(ColumnElement):
))
-class AggregateFilter(ColumnElement):
- """Represent an aggregate FILTER clause.
+class FunctionFilter(ColumnElement):
+ """Represent a function FILTER clause.
- This is a special operator against aggregate functions,
+ This is a special operator against aggregate and window functions,
which controls which rows are passed to it.
It's supported only by certain database backends.
"""
- __visit_name__ = 'aggregatefilter'
+ __visit_name__ = 'funcfilter'
criterion = None
def __init__(self, func, *criterion):
- """Produce an :class:`.AggregateFilter` object against a function.
+ """Produce an :class:`.FunctionFilter` object against a function.
- Used against aggregate functions,
- for database backends that support aggregate "FILTER" clause.
+ Used against aggregate and window functions,
+ for database backends that support the "FILTER" clause.
E.g.::
- from sqlalchemy import aggregatefilter
- aggregatefilter(func.count(1), MyClass.name == 'some name')
+ from sqlalchemy import funcfilter
+ funcfilter(func.count(1), MyClass.name == 'some name')
Would produce "COUNT(1) FILTER (WHERE myclass.name = 'some name')".
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py
index 7b22cab3e..2e10b7370 100644
--- a/lib/sqlalchemy/sql/expression.py
+++ b/lib/sqlalchemy/sql/expression.py
@@ -36,7 +36,7 @@ from .elements import ClauseElement, ColumnElement,\
True_, False_, BinaryExpression, Tuple, TypeClause, Extract, \
Grouping, not_, \
collate, literal_column, between,\
- literal, outparam, type_coerce, ClauseList, AggregateFilter
+ literal, outparam, type_coerce, ClauseList, FunctionFilter
from .elements import SavepointClause, RollbackToSavepointClause, \
ReleaseSavepointClause
@@ -97,8 +97,8 @@ outerjoin = public_factory(Join._create_outerjoin, ".expression.outerjoin")
insert = public_factory(Insert, ".expression.insert")
update = public_factory(Update, ".expression.update")
delete = public_factory(Delete, ".expression.delete")
-aggregatefilter = public_factory(
- AggregateFilter, ".expression.aggregatefilter")
+funcfilter = public_factory(
+ FunctionFilter, ".expression.funcfilter")
# internal functions still being called from tests and the ORM,
diff --git a/lib/sqlalchemy/sql/functions.py b/lib/sqlalchemy/sql/functions.py
index 46f3e27dc..a07eca8c6 100644
--- a/lib/sqlalchemy/sql/functions.py
+++ b/lib/sqlalchemy/sql/functions.py
@@ -12,7 +12,7 @@ from . import sqltypes, schema
from .base import Executable, ColumnCollection
from .elements import ClauseList, Cast, Extract, _literal_as_binds, \
literal_column, _type_from_args, ColumnElement, _clone,\
- Over, BindParameter, AggregateFilter
+ Over, BindParameter, FunctionFilter
from .selectable import FromClause, Select, Alias
from . import operators
@@ -119,8 +119,8 @@ class FunctionElement(Executable, ColumnElement, FromClause):
def filter(self, *criterion):
"""Produce a FILTER clause against this function.
- Used against aggregate functions,
- for database backends that support aggregate "FILTER" clause.
+ Used against aggregate and window functions,
+ for database backends that support the "FILTER" clause.
The expression::
@@ -128,15 +128,15 @@ class FunctionElement(Executable, ColumnElement, FromClause):
is shorthand for::
- from sqlalchemy import aggregatefilter
- aggregatefilter(func.count(1), True)
+ from sqlalchemy import funcfilter
+ funcfilter(func.count(1), True)
- See :func:`~.expression.aggregatefilter` for a full description.
+ See :func:`~.expression.funcfilter` for a full description.
"""
if not criterion:
return self
- return AggregateFilter(self, *criterion)
+ return FunctionFilter(self, *criterion)
@property
def _from_objects(self):