From 0c7a867ac73f1ed0ecfa134e907654fd4f7c084b Mon Sep 17 00:00:00 2001 From: Gord Thompson Date: Sat, 1 Aug 2020 15:56:12 -0600 Subject: 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 --- lib/sqlalchemy/dialects/postgresql/json.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'lib/sqlalchemy/dialects/postgresql/json.py') 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() -- cgit v1.2.1