Hi all,
I've got a situation where I want to use inherited mappers, with joins
to other inherited mappers. However I'm getting some weird results
where the following query should show no cat objects, instead I get 2
back for both queries.
Can anyone spot the flaw in my code here ?
The api and
I'm getting a strange error when I specify primaryjoin in relation().
Here's a short script to reproduce the error:
#!/usr/bin/env python
from sqlalchemy import *
from sqlalchemy.types import *
from sqlalchemy.orm import *
engine = create_engine('sqlite:///:memory:', echo=True)
metadata =
On Dec 29, 2007, at 12:46 AM, Jonathan Gardner wrote:
I'm getting a strange error when I specify primaryjoin in relation().
the error is because of the allow_column_override, combined with the
fact that you haven't reassigned the column attributes for left and
right. the left and right
I see two things that are problematic here. one potential problem,
but is probably OK in this example, is that you have a vet property
defined on both Cat and Dog and they are both set up to eagerly load
using a join. this might create problems if you try to query for
_Animal objects
I found the problem goes away if I don't try to overload the names,
Still, it would be nice if this wasn't cause a problem.
The solution is to rename the columns in table2 to right_id and
left_id, and to not use the allow_column_override option in the
mapper() function.
If that isn't an option,
Michael Bayer wrote:
the error is because of the allow_column_override, combined with the
fact that you haven't reassigned the column attributes for left and
right. the left and right columns on table2 need to be
available as scalar attributes on your Table2 class since thats how