the polymorphic join is fine.  the combination of equivalent columns 
is not an issue.  the creation of the query is built against a 
particular mapper's selectable; when a row from that query is passed 
to a different mapper due to a polymorphic switch, the row is 
translated to be against the columns that the target mapper expects.  
the error here is that the "Engineer" mapper is trying to do a 
"polymorphic mapper lookup" on a row that was given to it by the 
"polymorphic mapper lookup" on Employee, and is trying to use the 
column that you gave it, "pu_Employee.c.atype", on a row which in fact 
links only to the exact Column object "table_Employee.c.atype", which 
is because the Employee mapper created that row in its translate_row() 
step.  so rev 2260 adds a flag saying "i already did the polymorphic 
lookup; youre the mapper for this row".

for homework, you have to tell me if this program will succeed or 
fail:

from sqlalchemy import *

meta = MetaData()

t1 = Table('table1', meta,
    Column('col1', Integer, primary_key=True),
    Column('col2', Integer),
    Column('col3', Integer),
    Column('col4', Integer),
)

t2 = Table('table2', meta,
    Column('col1', Integer, primary_key=True),
    Column('col2', Integer),
    Column('col3', Integer)
)

j1 = t1.join(t2, t1.c.col1==t2.c.col1)

u1 = union_all(t1.select(), j1.select())

print [t2.corresponding_column(c) for c in u1.c]




On Jan 27, 11:54 am, [EMAIL PROTECTED] wrote:
> have u checked this one? it's still failing, same error.
>
> > hello.
> > i'm testing next level of complexity - 3 level inheritance.
> > C inherits B inherits A, all via table-inheritance, no relations.
> > A,B are with polymorphic mappers via unions.
> > e.g. A=Employee, B=Engineer, C=Manager.
>
> > The problem is: i cannot query the base polymorphic mapper A.
> > querying B and C is ok (as well as any other levels above, and/or
> > non-polymorphic mappers on all levels).
>
> > The error is:
> > sqlalchemy.exceptions.NoSuchColumnError:
> > "Could not locate column in row for column 'pu_Engineer.atype'
>
> > (Engineer is level B in this case.)
>
> > see/run attached file


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to