]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- documentation for any()/all()
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 28 Jan 2013 18:49:18 +0000 (13:49 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 28 Jan 2013 18:49:18 +0000 (13:49 -0500)
doc/build/changelog/changelog_08.rst
lib/sqlalchemy/dialects/postgresql/base.py

index b17a7e7d17418fb7126c84a1a8f7a8145dbc8d1a..bcdd77fa16922ed87f50cb240abe4902ac076b4f 100644 (file)
@@ -6,6 +6,15 @@
 .. changelog::
     :version: 0.8.0
 
+    .. change::
+        :tags: feature, postgresql
+        :pullreq: 40
+
+      Added :meth:`.postgresql.ARRAY.Comparator.any` and
+      :meth:`.postgresql.ARRAY.Comparator.all`
+      methods, as well as standalone expression constructs.   Big thanks
+      to Audrius Kažukauskas for the terrific work here.
+
     .. change::
         :tags: sql, bug
         :tickets: 2643
index de150f03fe33b800dd6ede6d76e80e0553ed49f3..a7a9e65ce1dbb911fc04b091ef2013f8a975c1f4 100644 (file)
@@ -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)