there's no magic on that one, you'd need to probably write some routine that digs into each select() and does what you need, looking at stmt._whereclause and whatever else you want to pull from each one and then build up a new select() that does what you want. The introspection of a Select object is semi-public at this point but basic things like where/order_by etc. are directly available if you take a peek at the source.
On Sep 22, 2014, at 1:26 PM, Matthew Rocklin <mrock...@gmail.com> wrote: > Thanks for the response Michael. > > If you're interested, a follow-up question. > > http://stackoverflow.com/questions/25979620/sqlalchemy-join-expressions-without-nesting > > On Friday, September 19, 2014 10:21:05 AM UTC-4, Michael Bayer wrote: > its at the bottom but i didn't go through the effort to make an example.... > > On Sep 19, 2014, at 9:50 AM, Matthew Rocklin <mroc...@gmail.com> wrote: > >> Inner_columns ended up being the solution on stack-overflow. The current >> answer that provides this is somewhat convoluted though. >> >> If you wanted to say exactly what you just said on SO I'd be happy to mark >> it as correct for future reference. >> >> On Fri, Sep 19, 2014 at 9:49 AM, Michael Bayer <mik...@zzzcomputing.com> >> wrote: >> you use with_only_columns but the columns you place into it must come from >> that list that was sent to the select() originally, and *not* the exported >> columns of the select itself. >> >> You either have to hold onto these columns externally, or get at them via >> the select.inner_columns accessor. >> >> >> >> On Sep 19, 2014, at 6:30 AM, Matthew Rocklin <mroc...@gmail.com> wrote: >> >>> How can I reorder the columns in a SQLAlchemy query object without causing >>> undue nesting? >>> >>> I've asked this question with an example on StackOverflow. Thought I'd >>> advertise it here as well. Please let me know if this is not preferred. >>> >>> >>> >>> http://stackoverflow.com/questions/25914329/rearrange-columns-in-sqlalchemy-select-object >>> >>> >>> >>> Best, >>> >>> -Matthew >>> >>> >>> -- >>> 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+...@googlegroups.com. >>> To post to this group, send email to sqlal...@googlegroups.com. >>> Visit this group at http://groups.google.com/group/sqlalchemy. >>> For more options, visit https://groups.google.com/d/optout. >> >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "sqlalchemy" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/sqlalchemy/OxowS9BhAKE/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> sqlalchemy+...@googlegroups.com. >> To post to this group, send email to sqlal...@googlegroups.com. >> Visit this group at http://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+...@googlegroups.com. >> To post to this group, send email to sqlal...@googlegroups.com. >> Visit this group at http://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 http://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 http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.