On Mar 2, 2012, at 6:32 AM, Pau Tallada wrote: > Great! > > I'll test it ASAP. > > BTW, is it hard to implement CTE with the ORM layer? :P
what you'd do is use query() to create a SELECT statement, then call .statement.cte() on it. Then you use that in another Query as something you can select FROM just like any other subquery. If you're doing recursive + UNION I think it's best to keep that on the core selectable you get back from cte(). It seems like WITH RECURSIVE...UNION needs a lot of aliasing so I'm not seeing a way to cut down on that verbosity. You should be able to use an aliased(MyClass) construct in the same way you'd normally do sometable.alias(). I can add query.cte() as a shortcut for that, it's basically analogous to query.subquery(). > > Thanks!! > > 2012/3/1 Michael Bayer <mike...@zzzcomputing.com> > right, I had the notion that it meant the JOIN is up at the top but that's > silly, it works fine so here's the patch without anything "not implemented": > > http://www.sqlalchemy.org/trac/attachment/ticket/1859/1859.patch > > > someone else noted that you can use CTEs with INSERT, UPDATE, DELETE also, > that will be for another day, similar syntax should work > > > On Mar 1, 2012, at 3:12 PM, Claudio Freire wrote: > > > On Thu, Mar 1, 2012 at 5:08 PM, Michael Bayer <mike...@zzzcomputing.com> > > wrote: > >> OK also, this is ready to go in from my perspective, I don't make usage of > >> CTEs in my normal work at the moment, so hopefully those people here > >> interested in the feature can give this a review, maybe even try the > >> patch, because this will be it ! > > > > Why is joining not supported in that patch? > > > > I would imagine it should be possible, with explicit join conditions of > > course. > > > > -- > > You received this message because you are subscribed to the Google Groups > > "sqlalchemy" group. > > To post to this group, send email to sqlalchemy@googlegroups.com. > > To unsubscribe from this group, send email to > > sqlalchemy+unsubscr...@googlegroups.com. > > For more options, visit this group at > > http://groups.google.com/group/sqlalchemy?hl=en. > > > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalchemy@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > > > > > -- > ---------------------------------- > Pau Tallada Crespí > Dep. d'Astrofísica i Cosmologia > Port d'Informació Científica (PIC) > Tel: +34 93 586 8233 > ---------------------------------- > > > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalchemy@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.