]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
limit None->null coercion to not occur with crud
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 15 Jul 2021 15:25:31 +0000 (11:25 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 15 Jul 2021 19:09:28 +0000 (15:09 -0400)
commit03794d40f31cd1c8501c528eda6c351559c1f739
tree228f8bd94dd2fd52ce7dc119fdf23be1960c1a47
parentdaaf36840bb3ebbaea3722413998604ed21d36a8
limit None->null coercion to not occur with crud

Fixed issue where type-specific bound parameter handlers would not be
called upon in the case of using the :meth:`_sql.Insert.values` method with
the Python ``None`` value; in particular, this would be noticed when using
the :class:`_types.JSON` datatype as well as related PostgreSQL specific
types such as :class:`_postgresql.JSONB` which would fail to encode the
Python ``None`` value into JSON null, however the issue was generalized to
any bound parameter handler in conjunction with this specific method of
:class:`_sql.Insert`.

The issue with coercions forcing out ``null()`` may still impact
SQL expression usage as well; the change here is limited to crud
as the behavior there is relevant to some use cases, which may
need to be evaluated separately.

Fixes: #6770
Change-Id: If53edad811b37dada7578a89daf395628db058a6
doc/build/changelog/unreleased_14/6770.rst [new file with mode: 0644]
lib/sqlalchemy/sql/coercions.py
lib/sqlalchemy/sql/sqltypes.py
lib/sqlalchemy/testing/suite/test_types.py
test/sql/test_types.py