i have 4 tables, a, b, c, d.
a has one-to-many relation with b, b with one-to-one relationship with c, c
is a polymorphic on a.type, with d being one of the polymorphic types.
is there a way to implement this?
details:
this is what im trying to do in sqlalchemy:
a = Table('a', metadata,
Column( 'id', Integer(), primary_key=True ),
Column( 'type', UnicodeText() ) )
b = Table('b', metadata,
Column( 'id', Integer(), primary_key=True ),
Column( 'a_id', Integer(), ForeignKey('a.id') ) )
c = Table('c', metadata,
Column( 'id', Integer(), primary_key=True ),
Column( 'b_id', Integer(), ForeignKey('b.id') ),
Column( 'class_id', Integer() ) )
d = Table('d', metadata,
Column( 'id', Integer(), primary_key=True ),
Column( 'data', Integer() )
mappers
mapper( A, a )
mapper( B, b, properties={'a': relationship( A,
uselist=False,backref='b',
'c':relationship( C, uselist=False, backref='b') })
# Does a full join, does not work
mapper( C, c, polymorphic_on = a.c.type )
mapper( D, d, inherits=C, polymorphic_identity = "D" )
how can i change c to polymorphic on a, through the relationship? is there
a way to sort by d.data? (b-c/d is one-on-one).
--
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.