I think I've answered my own question with the use_labels=True option
to select(). ;-)
At 17:33 21.4.06, Peter L. Buschman wrote:
Most likely another newbie question, but how do I resolve an
ambiguous column name that
is present in two tables after a joing?
For example, SQL lets me address the ambiguous column just by
prefixing the table name.
SELECT table1.colum, table2.column
FROM table1
INNER JOIN table2 on table2.id = table1.id
However, if I perform the following query in SQL alchemy, I can only
access by column name.
Trying to access row['table1.column'] results in a KeyError exception.
query = select[table1, table2], from_obj=[
table1.join(
table2, table2.c.id == table1.c.id
)
results = query.execute()
for row in results.fetchall():
print row.column
How can I access both table1 and table2's column value from the same
row object?
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users