this is probably already apparent but if I had this sort of problem, I'd more be asking why do I have this problem in the first place, that is, my program has made these two SELECT objects that need to be combined, they instead should be making two "data criteria" objects of some kind that can be constructed into a statement later. that is, you need more abstraction here and you need to bind to the SQL expression system later.
On Sep 22, 2014, at 1:32 PM, Matthew Rocklin <[email protected]> wrote: > My current solution is to rely on `replace_selectable` but it's not > particularly robust. > > On Mon, Sep 22, 2014 at 1:30 PM, Michael Bayer <[email protected]> > wrote: > 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 <[email protected]> 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 <[email protected]> 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 <[email protected]> >>> 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 <[email protected]> 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 [email protected]. >>>> To post to this group, send email to [email protected]. >>>> 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 >>> [email protected]. >>> To post to this group, send email to [email protected]. >>> 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 [email protected]. >>> To post to this group, send email to [email protected]. >>> 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 [email protected]. >> To post to this group, send email to [email protected]. >> 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 > [email protected]. > To post to this group, send email to [email protected]. > 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 [email protected]. > To post to this group, send email to [email protected]. > 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
