summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/base.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-01-28 13:49:18 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2013-01-28 13:49:18 -0500
commit1c82e1cff7ae9047684676c863092c4659142f28 (patch)
treeeb865cf17c44afc13b258cd54d362b18892113d7 /lib/sqlalchemy/dialects/postgresql/base.py
parentdbdf4f25e2b1054e8f843f8ed0256ece86d68080 (diff)
downloadsqlalchemy-1c82e1cff7ae9047684676c863092c4659142f28.tar.gz
- documentation for any()/all()
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py76
1 files changed, 64 insertions, 12 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py
index de150f03f..a7a9e65ce 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -366,12 +366,15 @@ class _Slice(expression.ColumnElement):
class Any(expression.ColumnElement):
- """Return the clause ``left operator ANY (right)``. ``right`` must be
+ """Represent the clause ``left operator ANY (right)``. ``right`` must be
an array expression.
- See also:
+ .. seealso::
+
+ :class:`.postgresql.ARRAY`
+
+ :meth:`.postgresql.ARRAY.Comparator.any` - ARRAY-bound method
- :class:`.postgresql.ARRAY`
"""
__visit_name__ = 'any'
@@ -383,12 +386,15 @@ class Any(expression.ColumnElement):
class All(expression.ColumnElement):
- """Return the clause ``left operator ALL (right)``. ``right`` must be
+ """Represent the clause ``left operator ALL (right)``. ``right`` must be
an array expression.
- See also:
+ .. seealso::
+
+ :class:`.postgresql.ARRAY`
+
+ :meth:`.postgresql.ARRAY.Comparator.all` - ARRAY-bound method
- :class:`.postgresql.ARRAY`
"""
__visit_name__ = 'all'
@@ -537,16 +543,62 @@ class ARRAY(sqltypes.Concatenable, sqltypes.TypeEngine):
result_type=return_type)
def any(self, other, operator=operators.eq):
- """Return ``other operator ANY (array)`` clause. Argument places
- are switched, because ANY requires array expression to be on the
- right hand-side.
+ """Return ``other operator ANY (array)`` clause.
+
+ Argument places are switched, because ANY requires array
+ expression to be on the right hand-side.
+
+ E.g.::
+
+ from sqlalchemy.sql import operators
+
+ conn.execute(
+ select([table.c.data]).where(
+ table.c.data.any(7, operator=operators.lt)
+ )
+ )
+
+ :param other: expression to be compared
+ :param operator: an operator object from the
+ :mod:`sqlalchemy.sql.operators`
+ package, defaults to :func:`.operators.eq`.
+
+ .. seealso::
+
+ :class:`.postgresql.Any`
+
+ :meth:`.postgresql.ARRAY.Comparator.all`
+
"""
return Any(other, self.expr, operator=operator)
def all(self, other, operator=operators.eq):
- """Return ``other operator ALL (array)`` clause. Argument places
- are switched, because ALL requires array expression to be on the
- right hand-side.
+ """Return ``other operator ALL (array)`` clause.
+
+ Argument places are switched, because ALL requires array
+ expression to be on the right hand-side.
+
+ E.g.::
+
+ from sqlalchemy.sql import operators
+
+ conn.execute(
+ select([table.c.data]).where(
+ table.c.data.all(7, operator=operators.lt)
+ )
+ )
+
+ :param other: expression to be compared
+ :param operator: an operator object from the
+ :mod:`sqlalchemy.sql.operators`
+ package, defaults to :func:`.operators.eq`.
+
+ .. seealso::
+
+ :class:`.postgresql.All`
+
+ :meth:`.postgresql.ARRAY.Comparator.any`
+
"""
return All(other, self.expr, operator=operator)