I have the following python classes. class Instrument (object):
def __init__ (self, name): self.name = name class Equity (Instrument): def __init__ (self, name, currency_id): Instrument.__init__(self, name) self.currency_id = currency_id class Currency (Instrument): pass Pretty simple cut down example. Equity has a relationship with a currency Mapping is as follows instruments = Table ('instruments', metadata, Column ('id', Integer, primary_key=True), Column ('type', String (10), nullable=False), Column ('name', String(50), nullable=False, unique=True), Column ('currency_id', Integer, ForeignKey ('instruments.id')) ) instrument_mapper = mapper (Instrument, instruments, polymorphic_on=instruments.c.type, polymorphic_identity='instrument') equity_mapper = mapper (Equity, inherits=instrument_mapper, polymorphic_identity='equity') currency_mapper = mapper (Currency, inherits=instrument_mapper, polymorphic_identity='currency', properties={'equities': relationship (Instrument, backref=backref('currency', remote_side=[instruments.c.id]))} ) One thing I'm not sure about. The currency mapper should have a relationship with Currency and not with Instruments. ie. I want to restrict the relationship to Currencies. Is there a standard way of going around this? Nick -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.