Ah sorry, I wasn't clearer earlier. The text() call will take an arbitrary 
SQL string from the user, so there's no easy way to know which columns to 
pass into the .columns() call (short of parsing the statement and then 
using reflected MetaData to populate the columns from the relevant tables 
referenced in the query string). This is also an issue on core generated 
aggregation queries. I guess my question is if the ResultProxy has any 
metadata on the results of the query (besides the key).

Thanks,
Naveen

On Thursday, November 19, 2015 at 11:18:09 AM UTC-5, Michael Bayer wrote:
>
>
>
> On 11/19/2015 09:48 AM, Naveen Michaud-Agrawal wrote: 
> > I'm building a small GUI on top of sqlalchemy and would like to change 
> > the alignment of the columns based on the type (string or numeric). This 
> > works fine when the query is generated through query objects (using Mike 
> > Bayer's answer 
> > from 
> http://stackoverflow.com/questions/2258072/sqlalchemy-getting-column-data-types-of-query-results,
>  
>
> > using either q.columns or res.context.compiled.statement.columns), but 
> > those aren't populated on a TextFrom object (or it's response). Is there 
> > any way short of checking the resulting data? 
>
> anything that selects columns has a .c. collection, including TextAsFrom: 
>
> >>> from sqlalchemy import text, column, String, Integer 
> >>> t = text("select a, b from table").columns(column('a', String), 
> column('b', Integer)) 
> >>> t.c.a.type 
> String() 
> >>> t.c.b.type 
> Integer() 
>
>
>
>
> > 
> > Thanks, 
> > Naveen 
> > 
> > -- 
>

-- 
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.

Reply via email to