On Mar 20, 2014, at 9:22 AM, lars van gemerden <l...@rational-it.com> wrote:

> I solved it (again):
> 
> for future reference:
> 
> say you have the expression Person.name (Person is SQLA class) to use in a 
> query, to have a label show up under that name in the resulting KeyedTuple's:
> 
> to do:
> 
> Person.name.label("something") 
> 
> is not enough, you have to do:
> 
> expr = Person.name.label("something") 
> 
> and something like query.add_column(expr) after.
> 
> Also Person.name.label("Person.name") and  
> Person.name.label("Person_name")give exceptions!
> 
> (I am auto generating labels to use as column names on gui tables in a web 
> page and guess which 2 i tried first :-)


you can query for the label up front, query(Person.name.label('foo'))

also what's the exception with those other labels?

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