]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Ensure Variant passes along impl right-hand type
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 22 Nov 2016 20:36:32 +0000 (15:36 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 22 Nov 2016 21:39:16 +0000 (16:39 -0500)
commitdf9b6492e5ca47e26d539d2283fa816a2d5c8ad6
treebf85a7744760077d38d9ad59043c68d95d80321c
parent7de0d1785335961ce0f723877ca7a8fd85b2c0ca
Ensure Variant passes along impl right-hand type

Fixed issue in :class:`.Variant` where the "right hand coercion" logic,
inherited from :class:`.TypeDecorator`, would
coerce the right-hand side into the :class:`.Variant` itself, rather than
what the default type for the :class:`.Variant` would do.   In the
case of :class:`.Variant`, we want the type to act mostly like the base
type so the default logic of :class:`.TypeDecorator` is now overridden
to fall back to the underlying wrapped type's logic.   Is mostly relevant
for JSON at the moment.

This patch additionally adds documentation and basic tests to allow
for backend-agnostic comparison of JSON index elements to other objects.
A future version should attempt to improve upon this by providing
"astext", "asint" types of operators.

Change-Id: I7b7b45d604a4ae8d1dc236a5a1248695aab5232e
Fixes: #3859
doc/build/changelog/changelog_11.rst
lib/sqlalchemy/sql/sqltypes.py
lib/sqlalchemy/sql/type_api.py
lib/sqlalchemy/testing/suite/test_types.py
test/sql/test_types.py