the deannotation step is making a clone of the CTE and not maintaining all the linkages properly. Likely a bug but a really deep one I could use some help on.

if you can confirm the query is correct with this patch:

diff --git a/lib/sqlalchemy/orm/properties.py b/lib/sqlalchemy/orm/properties.py
index f3dce75..45b9e83 100644
--- a/lib/sqlalchemy/orm/properties.py
+++ b/lib/sqlalchemy/orm/properties.py
@@ -118,8 +118,9 @@ class ColumnProperty(StrategizedProperty):
         """
         super(ColumnProperty, self).__init__()
         self._orig_columns = [expression._labeled(c) for c in columns]
-        self.columns = [expression._labeled(_orm_full_deannotate(c))
-                        for c in columns]
+        #self.columns = [expression._labeled(_orm_full_deannotate(c))
+        #                for c in columns]
+        self.columns = [expression._labeled(c) for c in columns]
         self.group = kwargs.pop('group', None)
         self.deferred = kwargs.pop('deferred', False)
         self.instrument = kwargs.pop('_instrument', True)

then we know it's strictly the visit-clone step. isolated test case would need to be constructed, the style we're looking for would be along the lines of what we see in https://bitbucket.org/zzzeek/sqlalchemy/src/31a0da32a8af2503c6b94123a0e869816d83c707/test/sql/test_generative.py?at=master&fileviewer=file-view-default#test_generative.py-299 though perhaps the CTE specific tests would be in test/sql/test_cte.py.



On 06/09/2016 10:11 AM, Adrian wrote:
I've already tried not specifying a name - in that case it's `anon_2` in
the error.

Here's an MCVE:
https://gist.github.com/ThiefMaster/593e5a78f08d6323eb1b88270256baa7

--
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to sqlalchemy+unsubscr...@googlegroups.com
<mailto:sqlalchemy+unsubscr...@googlegroups.com>.
To post to this group, send email to sqlalchemy@googlegroups.com
<mailto:sqlalchemy@googlegroups.com>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to