4 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: how to get column na...
FromSent OnAttachments
vkuznet24 Feb 2007 12:29 
Jonathan Ellis26 Feb 2007 09:50 
King Simon-NFHD7826 Feb 2007 10:02 
vkuznet26 Feb 2007 12:33 
Subject:[sqlalchemy] Re: how to get column names in result
From:King Simon-NFHD78 (simo@motorola.com)
Date:02/26/2007 10:02:28 AM
List:com.googlegroups.sqlalchemy

Also, the rows that you get back from a 'select' are instances of RowProxy, so you can use row.keys() to get the names even after column labels have been applied.

http://www.sqlalchemy.org/docs/docstrings.myt#docstrings_sqlalchemy.engi ne_RowProxy

Simon

-----Original Message----- From: sqla@googlegroups.com [mailto:sqla@googlegroups.com] On Behalf Of Jonathan Ellis Sent: 26 February 2007 17:51 To: sqla@googlegroups.com Subject: [sqlalchemy] Re: how to get column names in result

You can see what columns are part of a table (or a select!) with .columns.keys() or .c.keys().

On 2/24/07, vkuznet <vkuz@gmail.com> wrote:

Hi, a very simple question which I cannot find in documentation. How to get column names together with result. This is useful for web presentation of results using templates. I used use_labels=True, indeed it construct query with names, but my final result contains only column values. What I wanted is to get as a first row the column names.

Thanks, Valentin.