diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-05-28 08:29:24 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-05-28 10:35:51 -0400 |
| commit | 460bed7cfd8a6dd035caff5f5b1b33edf96fa3bb (patch) | |
| tree | f693d05af509b210fe64255459b73bb425bb054e /test/aaa_profiling | |
| parent | aaba0650d7410f579b2c14f8f1b0680a1d1852c4 (diff) | |
| download | sqlalchemy-460bed7cfd8a6dd035caff5f5b1b33edf96fa3bb.tar.gz | |
Fix adaption in AnnotatedLabel; repair needless expense in coercion
Fixed regression involving clause adaption of labeled ORM compound
elements, such as single-table inheritance discriminator expressions with
conditionals or CASE expressions, which could cause aliased expressions
such as those used in ORM join / joinedload operations to not be adapted
correctly, such as referring to the wrong table in the ON clause in a join.
This change also improves a performance bump that was located within the
process of invoking :meth:`_sql.Select.join` given an ORM attribute
as a target.
Fixes: #6550
Change-Id: I98906476f0cce6f41ea00b77c789baa818e9d167
Diffstat (limited to 'test/aaa_profiling')
| -rw-r--r-- | test/aaa_profiling/test_orm.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/aaa_profiling/test_orm.py b/test/aaa_profiling/test_orm.py index 8116e5f21..356ea252d 100644 --- a/test/aaa_profiling/test_orm.py +++ b/test/aaa_profiling/test_orm.py @@ -2,6 +2,7 @@ from sqlalchemy import and_ from sqlalchemy import ForeignKey from sqlalchemy import Integer from sqlalchemy import join +from sqlalchemy import select from sqlalchemy import String from sqlalchemy import testing from sqlalchemy.orm import aliased @@ -966,6 +967,21 @@ class JoinConditionTest(NoCache, fixtures.DeclarativeMappedTest): go() + def test_a_to_b_aliased_select_join(self): + A, B = self.classes("A", "B") + + b1 = aliased(B) + + stmt = select(A) + + @profiling.function_call_count(times=50, warmup=1) + def go(): + # should not do any adaption or aliasing, this is just getting + # the args. See #6550 where we also fixed this. + stmt.join(A.b.of_type(b1)) + + go() + def test_a_to_d(self): A, D = self.classes("A", "D") |
