]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Raise informative exception for non-sortable PK
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 6 Apr 2018 15:39:15 +0000 (11:39 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 9 Apr 2018 13:15:52 +0000 (09:15 -0400)
commit036cdbe7fb2d651ba5fbbc758c8584df011c8043
tree651aa5734525e5784a0f879b7752cbfd45fa4922
parent5abeee69e34d45796cdff0770f58f9104da74701
Raise informative exception for non-sortable PK

An informative exception is re-raised when a primary key value is not
sortable in Python during an ORM flush under Python 3, such as an ``Enum``
that has no ``__lt__()`` method; normally Python 3 raises a ``TypeError``
in this case.   The flush process sorts persistent objects by primary key
in Python so the values must be sortable.

Change-Id: Ia186968982dcd1234b82f2e701fefa2a1668a7e4
Fixes: #4232
doc/build/changelog/unreleased_13/4232.rst [new file with mode: 0644]
lib/sqlalchemy/orm/persistence.py
lib/sqlalchemy/sql/sqltypes.py
test/orm/test_unitofwork.py