]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Use UnsupportedCompilationError for no default compiler
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 14 Jan 2021 16:18:58 +0000 (11:18 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 14 Jan 2021 18:05:52 +0000 (13:05 -0500)
commitb10549073cd77347d0ad9dcaac2f9358860f62fd
tree9648ff4c0780e62b71f3b8762c064cb3097139de
parent3ce056f8a5e77d7b73d2ed19a39469a97679940a
Use UnsupportedCompilationError for no default compiler

Fixed issue where the stringification that is sometimes called when
attempting to generate the "key" for the ``.c`` collection on a selectable
would fail if the column were an unlabeled custom SQL construct using the
``sqlalchemy.ext.compiler`` extension, and did not provide a default
compilation form; while this seems like an unusual case, it can get invoked
for some ORM scenarios such as when the expression is used in an "order by"
in combination with joined eager loading.  The issue is that the lack of a
default compiler function was raising :class:`.CompileError` and not
:class:`.UnsupportedCompilationError`.

Fixes: #5836
Change-Id: I5af243b2c70c7dcca4b212a3869c3017a50c132b
(cherry picked from commit b4c6cfc2fde6c652e79ca157f8023a3f8941bc3c)
doc/build/changelog/unreleased_13/5836.rst [new file with mode: 0644]
lib/sqlalchemy/exc.py
lib/sqlalchemy/ext/compiler.py
test/ext/test_compiler.py