Couldn't it be handled with a mixin?
{{{
class _LoadCore(Base):
"""whatever you want for both classes here"""
pass
class Load(_LoadCore):
__tablename__ = 'load'
__mapper_args__ = {
'polymorphic_identity':'load',
'polymorphic_on':'polymorphic_type',
}
id = Column(Integer, primary_key=True)
polymorphic_type = Column(Text, nullable=False)
source_id = Column(Integer, ForeignKey('source.id'))
source = relationship('Source')
class Production_Load(_LoadCore):
__tablename__ = 'production_load'
__mapper_args__ = { 'polymorphic_identity':'production_load' }
id = Column(Integer, ForeignKey('load.id'), primary_key=True)
source_id = Column(Integer, ForeignKey('measured_source.id'))
source = relationship('Measured_Source')
}}
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.