Re: [sqlalchemy] Rearrange columns in SQLAlchemy core Select object

2014-09-22 Thread Matthew Rocklin
Hrm, that's an interesting thought. Any interest in a real-time conversation? This work is for Blaze btw. I'm lowering a relational algebra abstraction to a variety of other systems (pandas, spark, python, sqlalchemy, etc...) On Mon, Sep 22, 2014

Re: [sqlalchemy] Rearrange columns in SQLAlchemy core Select object

2014-09-22 Thread Michael Bayer
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 b

Re: [sqlalchemy] Rearrange columns in SQLAlchemy core Select object

2014-09-22 Thread Matthew Rocklin
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 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._where

Re: [sqlalchemy] Rearrange columns in SQLAlchemy core Select object

2014-09-22 Thread Michael Bayer
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 obje

Re: [sqlalchemy] Rearrange columns in SQLAlchemy core Select object

2014-09-22 Thread Matthew Rocklin
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

Re: [sqlalchemy] Rearrange columns in SQLAlchemy core Select object

2014-09-19 Thread Michael Bayer
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 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 exac

Re: [sqlalchemy] Rearrange columns in SQLAlchemy core Select object

2014-09-19 Thread Matthew Rocklin
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 wrote:

Re: [sqlalchemy] Rearrange columns in SQLAlchemy core Select object

2014-09-19 Thread Michael Bayer
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

[sqlalchemy] Rearrange columns in SQLAlchemy core Select object

2014-09-19 Thread Matthew Rocklin
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-col