Thomas Heller wrote:
> I'm doing my first steps with sqlalchemy - a really great package?
>
> Here is my question:
>
> I know already how to label columns or functions that I'm querying for,
> like this:
>
> session.query(count().label("foo"), MyClass.id.label("my_id"))
>
> How can I label the result when I search for a class?  This doesn't work:
>
> session.query(MyClass.label("spam"))

use my_alias = aliased(MyClass, name="spam")

then use "my_alias" instead of MyClass throughout your query.



>
> --
> Thanks,
> Thomas
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to