I followed advice in this question , but I still get this error: sqlalchemy.exc.NoForeignKeysError: Can't find any foreign key relationships between 'investment' and 'real_estate'.
Models
class Investment(db.Model): __tablename__ = 'investment' __mapper_args__ = {'polymorphic_identity': 'investment'} id = Column(db.Integer, primary_key=True) item_name = Column(db.String(64)) investment_type = Column(db.String(32), nullable=False) __mapper_args__ = {'polymorphic_on': investment_type} class RealEstate(Investment): __tablename__ = 'real_estate' __mapper_args__ = {'polymorphic_identity': 'real_estate'} id = Column(db.Integer, primary_key=True) current_balance = Column(db.Float)
I also updated the examples in this answer to reflect the changes in the SQLAlchemy docs, but nonetheless an error.
goal is that I do not want the attributes inherited by RealEstate to be in the investment table. I would like to inherit and store all of these attributes in a RealEstate table.
Can anyone see what I missed?
source share