summaryrefslogtreecommitdiff
path: root/test/sql/test_generative.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-09-06 12:45:53 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-09-06 13:17:24 -0400
commitfc48050e5d0c56fc5a6cd85679859e71961c59eb (patch)
tree78ade9f3586e12239023b2aa95510c653a004dd4 /test/sql/test_generative.py
parent5c39ef565bb63e4412c3c3d0e87330373c8926ce (diff)
downloadsqlalchemy-fc48050e5d0c56fc5a6cd85679859e71961c59eb.tar.gz
Adjustments to _copy_internals()
We are looking to build a generalization of copy_internals(), so move out any special logic from these methods. Re-implement and clarify rationale for the Alias doesnt copy a TableClause rule as part of the adaption traversal, establish that we forgot to build out comparison and cache key for CTE, remove incomplete _copy_internals() from GenerativeSelect (it doesn't handle the order_by_clause or group_by_clause, so is incomplete) Change-Id: I95039f042503171aade4ba0fabc9b1598e3c49cf
Diffstat (limited to 'test/sql/test_generative.py')
-rw-r--r--test/sql/test_generative.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/test/sql/test_generative.py b/test/sql/test_generative.py
index 8f06cf3db..262333dc5 100644
--- a/test/sql/test_generative.py
+++ b/test/sql/test_generative.py
@@ -1015,10 +1015,9 @@ class ClauseAdapterTest(fixtures.TestBase, AssertsCompiledSQL):
)
s = vis.traverse(s)
- assert t2alias not in s._froms # not present because it's been
- # cloned
+ assert t2alias in s._froms # present because it was not cloned
assert t1alias in s._froms # present because the adapter placed
- # it there
+ # it there and was also not cloned
# correlate list on "s" needs to take into account the full
# _cloned_set for each element in _froms when correlating
@@ -1592,7 +1591,18 @@ class ClauseAdapterTest(fixtures.TestBase, AssertsCompiledSQL):
s2 = select([s1]).limit(5).offset(10).alias()
talias = t1.alias("bar")
+ # here is the problem. s2 is derived from s1 which is derived
+ # from t1
+ assert s2.is_derived_from(t1)
+
+ # however, s2 is not derived from talias, which *is* derived from t1
assert not s2.is_derived_from(talias)
+
+ # therefore, talias gets its table replaced, except for a rule
+ # we added to ClauseAdapter to stop traversal if the selectable is
+ # not derived from an alias of a table. This rule was previously
+ # in Alias._copy_internals().
+
j = s1.outerjoin(talias, s1.c.col1 == talias.c.col1)
self.assert_compile(