Dear list,
I'm trying to join a table with itself. That works well. However since
the column names are identical I had no luck accessing both the original
and the joined information.
I have aliased the tables already and run the join on the aliased names.
But the column names are still not qualified.
Example:
records_a = model.records_table.alias('records_a')
records_ptr = model.records_table.alias('records_ptr')
joined = records_a.select(...,
from_obj=[outerjoin(records_a, records_ptr,
records_a.c.foo==records_ptr.c.bar)).execute().fetchone()
The records contain fields like 'id', 'type' or 'name'. So I tried
this and failed:
print joined[0].records_a.c.id
print joined[0]['records_a.id']
However I _can_ access the result columns without the table alias:
print joined[0].id
print joined[0]['id']
Is there some magical hidden parameter that qualifies the rows of the
result?
Kindly
Christoph
P.S.: I'm now trying the example from self-referential mappers.
But the general question is still valid because in every join
it might happen that column names overlap.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---