if you run session.query(T1, T2), the result you'd get back is currently the KeyedTuple object. it's a tuple, which you can refer to it by key, however, if T1 and T2 are mapped classes, the names of the keys would be "T1" and "T2", which are the names of the mapped classes.
If these were column expressions, you'd use label() to change their names, e.g. some_col.label("my_column"), however for ORM mapped classes, right now you can use aliased() to achieve this:
from sqlalchemy.orm import aliased
t1 = aliased(T1, name="t1")
t2 = aliased(T2, name="t2")
session.query(t1, t2).filter(t1.foo == 'bar').filter (etc)
those names will be applied to the named tuple result you get back. In the next major release, version 1.4, the KeyedTuple class is likely being replaced with a new object called "Row" but the user-facing behavior will be the same.
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
---
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.