summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/operators.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-09-27 10:14:57 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-09-27 15:49:29 -0400
commit944c662d8add498577d6359251d4b94cd84d4011 (patch)
treeacf7c45ef4ba10dde9a8d890b309defe69132830 /lib/sqlalchemy/sql/operators.py
parentdc4d1ee7bdf8f9670057e916a29f1f5252e77207 (diff)
downloadsqlalchemy-944c662d8add498577d6359251d4b94cd84d4011.tar.gz
Support method form of any_(), all_()
Fixed bug where the recently added :meth:`.ColumnOperators.any_` and :meth:`.ColumnOperators.all_` methods didn't work when called as methods, as opposed to using the standalone functions :func:`~.expression.any_` and :func:`~.expression.all_`. Also added documentation examples for these relatively unintuitive SQL operators. Change-Id: I3e56b463e9fd146a077b9970624f50cba27f9811 Fixes: #4093
Diffstat (limited to 'lib/sqlalchemy/sql/operators.py')
-rw-r--r--lib/sqlalchemy/sql/operators.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/operators.py b/lib/sqlalchemy/sql/operators.py
index a14afcb70..ef6f78929 100644
--- a/lib/sqlalchemy/sql/operators.py
+++ b/lib/sqlalchemy/sql/operators.py
@@ -802,6 +802,22 @@ class ColumnOperators(Operators):
"""Produce a :func:`~.expression.any_` clause against the
parent object.
+ This operator is only appropriate against a scalar subquery
+ object, or for some backends an column expression that is
+ against the ARRAY type, e.g.::
+
+ # postgresql '5 = ANY (somearray)'
+ expr = 5 == mytable.c.somearray.any_()
+
+ # mysql '5 = ANY (SELECT value FROM table)'
+ expr = 5 == select([table.c.value]).as_scalar().any_()
+
+ .. seealso::
+
+ :func:`~.expression.any_` - standalone version
+
+ :func:`~.expression.all_` - ALL operator
+
.. versionadded:: 1.1
"""
@@ -811,6 +827,22 @@ class ColumnOperators(Operators):
"""Produce a :func:`~.expression.all_` clause against the
parent object.
+ This operator is only appropriate against a scalar subquery
+ object, or for some backends an column expression that is
+ against the ARRAY type, e.g.::
+
+ # postgresql '5 = ALL (somearray)'
+ expr = 5 == mytable.c.somearray.all_()
+
+ # mysql '5 = ALL (SELECT value FROM table)'
+ expr = 5 == select([table.c.value]).as_scalar().all_()
+
+ .. seealso::
+
+ :func:`~.expression.all_` - standalone version
+
+ :func:`~.expression.any_` - ANY operator
+
.. versionadded:: 1.1
"""