]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Ensure all Query statements compile w/ orm, fix test harness
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 5 Mar 2021 21:02:38 +0000 (16:02 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 5 Mar 2021 21:06:26 +0000 (16:06 -0500)
commit8b8a4c373e1cec2203f73b1772704b9ded75c1fe
treea9129521118f2b4a54bd1c912c9e9497b47371b6
parent2929d5a1e08e9bd1f12d5a1a059018bf92ef6e29
Ensure all Query statements compile w/ orm, fix test harness

Fixed regression where :meth:`_orm.Query.join` would produce no effect if
the query itself as well as the join target were against a
:class:`_schema.Table` object, rather than a mapped class. This was part of
a more systemic issue where the legacy ORM query compiler would not be
correctly used from a :class:`_orm.Query` if the statement produced had not
ORM entities present within it.

Also repair the assert_compile() method, which was using
Query._compile_state() which was bypassing the bug.   A handful
of ORM tests with Query objects and Core-only objects were actually
failing if the default compilation path were used.

Fixes: #6003
Change-Id: I97478b2d06bf6c01fe1f09ee118e1f2ac4c849bc
doc/build/changelog/unreleased_14/6003.rst [new file with mode: 0644]
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/testing/assertions.py
test/orm/test_joins.py