summaryrefslogtreecommitdiff
path: root/test/sql/test_compare.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-06-15 15:13:34 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2021-06-17 09:48:52 -0400
commit5b3e887f46afdbee312d5efd2a14f7c9b7eeac65 (patch)
tree7c12dd2686dc3d26222383d39527b24613e49da3 /test/sql/test_compare.py
parent29fbbd9cebf5d4a4f21d01a74bcfb6dce923fe1b (diff)
downloadsqlalchemy-5b3e887f46afdbee312d5efd2a14f7c9b7eeac65.tar.gz
memoize current options and joins w with_entities/with_only_cols
Fixed further regressions in the same area as that of :ticket:`6052` where loader options as well as invocations of methods like :meth:`_orm.Query.join` would fail if the left side of the statement for which the option/join depends upon were replaced by using the :meth:`_orm.Query.with_entities` method, or when using 2.0 style queries when using the :meth:`_sql.Select.with_only_columns` method. A new set of state has been added to the objects which tracks the "left" entities that the options / join were made against which is memoized when the lead entities are changed. Fixes: #6503 Fixes: #6253 Change-Id: I211b2af98b0b20d1263fb15dc513884dcc5de6a4
Diffstat (limited to 'test/sql/test_compare.py')
-rw-r--r--test/sql/test_compare.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/sql/test_compare.py b/test/sql/test_compare.py
index 257776c50..e96a47553 100644
--- a/test/sql/test_compare.py
+++ b/test/sql/test_compare.py
@@ -514,6 +514,14 @@ class CoreFixtures(object):
),
),
lambda: (
+ # test issue #6503
+ # join from table_a -> table_c, select table_b.c.a
+ select(table_a).join(table_c).with_only_columns(table_b.c.a),
+ # join from table_b -> table_c, select table_b.c.a
+ select(table_b.c.a).join(table_c).with_only_columns(table_b.c.a),
+ select(table_a).with_only_columns(table_b.c.a),
+ ),
+ lambda: (
table_a.insert(),
table_a.insert().values({})._annotate({"nocache": True}),
table_b.insert(),