Hi all,

I've got a situation where I have a table of data that is common, with the
subtables just adding an extra couple of fields.  Using multiple inheritance I
fit it together as below (pretty much the same as the documented example).

What I'm having problems with is then accessing those child tables as properties
of the person table mapping.  I'm get the following error,

"""
Cant determine relation direction for 'example' on mapper 'Mapper|Person|person'
with primary join 'person.id = example.person_id' - foreign key columns are not
present in neither the parent nor the child's mapped
tablesset([Column('person_id',Integer(),ForeignKey('person.id'))])
"""

What am I missing here ?

Cheers
Dave

P.S that error should read "foreign key columns are present in neither ..."

####

exampleTable = Table(
    'example',
    Column('id', Integer, primary_key=True),
    Column('person_id', Integer, ForeignKey("person.id")),
    ...
)


subexample1Table = Table(
    'subexample1',
    Column('id', Integer, ForeignKey('example.id'), primary_key=True),
    Column('extra1', String(100)),
)


subexample2Table = Table(
    'subexample2',
    Column('id', Integer, ForeignKey('example.id'), primary_key=True),
    Column('extra2', String(100)),
)

####

example_mapper = mapper(Example, exampleTable)
mapper(Example1, subexample1Table, inherits=example_mapper)
mapper(Example2, subexample2Table, inherits=example_mapper)

####

mapper(
    Person,
    personTable,
    properties = {
        "examples": relation(Example1),
    },
    order_by=[personTable.c.surname, personTable.c.firstname]
)


--~--~---------~--~----~------------~-------~--~----~
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