From 1c82e1cff7ae9047684676c863092c4659142f28 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 28 Jan 2013 13:49:18 -0500 Subject: - documentation for any()/all() --- lib/sqlalchemy/dialects/postgresql/base.py | 76 +++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 12 deletions(-) (limited to 'lib/sqlalchemy/dialects/postgresql/base.py') 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) -- cgit v1.2.1