]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Improve type detection for Values / Tuple
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 18 Dec 2020 17:22:12 +0000 (12:22 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 19 Dec 2020 02:50:14 +0000 (21:50 -0500)
commit27766512b2d037a8f0048dccc6e2f02c281fbc9a
treef6f721ee5c1b4da3e0c644b43ab4c8bcec4debfa
parent8294a336b1e6f23b5a7244e7aa457321fd3580bd
Improve type detection for Values / Tuple

Fixed issue in new :class:`_sql.Values` construct where passing tuples of
objects would fall back to per-value type detection rather than making use
of the :class:`_schema.Column` objects passed directly to
:class:`_sql.Values` that tells SQLAlchemy what the expected type is. This
would lead to issues for objects such as enumerations and numpy strings
that are not actually necessary since the expected type is given.

note this changes NullType() to raise CompileError for
literal_processor; NullType() does not imply the actual value
NULL as much as it does "unknown type" so this should make failure
modes more clear.

Fixes: #5785
Change-Id: Ifbf5e78373102380b301098f30e15011efa98b5e
doc/build/changelog/unreleased_14/5785.rst [new file with mode: 0644]
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/selectable.py
lib/sqlalchemy/sql/sqltypes.py
test/sql/test_values.py