Re: [sqlalchemy] "CompileError: Multiple, unrelated CTEs found with the same name" when using column property

2016-06-10 Thread Mike Bayer
It's probably something small. A bb issue would be targeted at 1.0.x if you want to put one up On Friday, June 10, 2016, Adrian wrote: > Unless there'll be a release fixing this soon-ish: Is there any workaround > that doesn't require patching the sqlalchemy to avoid the issue? > Otherwise I'd

Re: [sqlalchemy] "CompileError: Multiple, unrelated CTEs found with the same name" when using column property

2016-06-10 Thread Adrian
Unless there'll be a release fixing this soon-ish: Is there any workaround that doesn't require patching the sqlalchemy to avoid the issue? Otherwise I'd probably go for a hack like this: @contextmanager def dirty_hack(): orig = sqlalchemy.orm.properties._orm_full_deannotate sqlalchemy.or

Re: [sqlalchemy] "CompileError: Multiple, unrelated CTEs found with the same name" when using column property

2016-06-09 Thread Adrian
Yes, works fine with this change. On Thursday, June 9, 2016 at 4:37:31 PM UTC+2, Mike Bayer wrote: > > > if you can confirm the query is correct with this patch: > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group an

Re: [sqlalchemy] "CompileError: Multiple, unrelated CTEs found with the same name" when using column property

2016-06-09 Thread Mike Bayer
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/properti

Re: [sqlalchemy] "CompileError: Multiple, unrelated CTEs found with the same name" when using column property

2016-06-09 Thread Adrian
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 gr

Re: [sqlalchemy] "CompileError: Multiple, unrelated CTEs found with the same name" when using column property

2016-06-09 Thread Mike Bayer
On 06/09/2016 05:39 AM, Adrian wrote: I'm trying to add a `deep_children_count` column property to one of my models. As a regular property it works perfectly fine but I'd like to make it a column property so I don't have to spam extra queries if I need the counts for multiple objects. So I tri

[sqlalchemy] "CompileError: Multiple, unrelated CTEs found with the same name" when using column property

2016-06-09 Thread Adrian
I'm trying to add a `deep_children_count` column property to one of my models. As a regular property it works perfectly fine but I'd like to make it a column property so I don't have to spam extra queries if I need the counts for multiple objects. So I tried this: cat_alias = db.aliased(Ca