summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/json.py
diff options
context:
space:
mode:
authorGord Thompson <gord@gordthompson.com>2020-08-01 15:56:12 -0600
committerMike Bayer <mike_mp@zzzcomputing.com>2020-08-19 11:05:52 -0400
commit0c7a867ac73f1ed0ecfa134e907654fd4f7c084b (patch)
treec645f7514e9f6b977b2440413b6572b40c0edbd5 /lib/sqlalchemy/dialects/postgresql/json.py
parent0901190bb440580f0664fe3f6310173762b908e0 (diff)
downloadsqlalchemy-0c7a867ac73f1ed0ecfa134e907654fd4f7c084b.tar.gz
Add JSON support for mssql
Added support for the :class:`_types.JSON` datatype on the SQL Server dialect using the :class:`_mssql.JSON` implementation, which implements SQL Server's JSON functionality against the ``NVARCHAR(max)`` datatype as per SQL Server documentation. Implementation courtesy Gord Thompson. Fixes: #4384 Change-Id: I28af79a4d8fafaa68ea032228609bba727784f18
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/json.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/json.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/json.py b/lib/sqlalchemy/dialects/postgresql/json.py
index 255f1af21..fbf61dd5f 100644
--- a/lib/sqlalchemy/dialects/postgresql/json.py
+++ b/lib/sqlalchemy/dialects/postgresql/json.py
@@ -97,12 +97,18 @@ class JSONPathType(sqltypes.JSON.JSONPathType):
class JSON(sqltypes.JSON):
"""Represent the PostgreSQL JSON type.
- This type is a specialization of the Core-level :class:`_types.JSON`
- type. Be sure to read the documentation for :class:`_types.JSON` for
- important tips regarding treatment of NULL values and ORM use.
+ :class:`_postgresql.JSON` is used automatically whenever the base
+ :class:`_types.JSON` datatype is used against a PostgreSQL backend,
+ however base :class:`_types.JSON` datatype does not provide Python
+ accessors for PostgreSQL-specific comparison methods such as
+ :meth:`_postgresql.JSON.Comparator.astext`; additionally, to use
+ PostgreSQL ``JSONB``, the :class:`_postgresql.JSONB` datatype should
+ be used explicitly.
- .. versionchanged:: 1.1 :class:`_postgresql.JSON` is now a PostgreSQL-
- specific specialization of the new :class:`_types.JSON` type.
+ .. seealso::
+
+ :class:`_types.JSON` - main documenation for the generic
+ cross-platform JSON datatype.
The operators provided by the PostgreSQL version of :class:`_types.JSON`
include:
@@ -167,6 +173,9 @@ class JSON(sqltypes.JSON):
:class:`_postgresql.JSONB`
+ .. versionchanged:: 1.1 :class:`_postgresql.JSON` is now a PostgreSQL-
+ specific specialization of the new :class:`_types.JSON` type.
+
""" # noqa
astext_type = sqltypes.Text()