]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Include operators in postgres JSONB documentation (#11828)
authorJimmy AUDEBERT <109511155+jaudebert@users.noreply.github.com>
Wed, 4 Sep 2024 17:23:53 +0000 (19:23 +0200)
committerFederico Caselli <cfederico87@gmail.com>
Wed, 4 Sep 2024 17:27:58 +0000 (19:27 +0200)
(cherry picked from commit 06ca61066ee312a5198cf1db869f388255212559)
Change-Id: I3e432a8b14309314f4c56d43841cba464518b125

lib/sqlalchemy/dialects/postgresql/json.py

index e6b6f58677e7805607b81eb69aa6144d109a9243..a72a6781d9236f05a643dc1ea3301871651a3d45 100644 (file)
@@ -294,22 +294,27 @@ class JSONB(JSON):
         """Define comparison operations for :class:`_types.JSON`."""
 
         def has_key(self, other):
-            """Boolean expression.  Test for presence of a key.  Note that the
-            key may be a SQLA expression.
+            """Boolean expression.  Test for presence of a key (equivalent of
+            the ``?`` operator).  Note that the key may be a SQLA expression.
             """
             return self.operate(HAS_KEY, other, result_type=sqltypes.Boolean)
 
         def has_all(self, other):
-            """Boolean expression.  Test for presence of all keys in jsonb"""
+            """Boolean expression.  Test for presence of all keys in jsonb
+            (equivalent of the ``?&`` operator)
+            """
             return self.operate(HAS_ALL, other, result_type=sqltypes.Boolean)
 
         def has_any(self, other):
-            """Boolean expression.  Test for presence of any key in jsonb"""
+            """Boolean expression.  Test for presence of any key in jsonb
+            (equivalent of the ``?|`` operator)
+            """
             return self.operate(HAS_ANY, other, result_type=sqltypes.Boolean)
 
         def contains(self, other, **kwargs):
             """Boolean expression.  Test if keys (or array) are a superset
-            of/contained the keys of the argument jsonb expression.
+            of/contained the keys of the argument jsonb expression
+            (equivalent of the ``@>`` operator).
 
             kwargs may be ignored by this operator but are required for API
             conformance.
@@ -318,7 +323,8 @@ class JSONB(JSON):
 
         def contained_by(self, other):
             """Boolean expression.  Test if keys are a proper subset of the
-            keys of the argument jsonb expression.
+            keys of the argument jsonb expression
+            (equivalent of the ``<@`` operator).
             """
             return self.operate(
                 CONTAINED_BY, other, result_type=sqltypes.Boolean