Broken support of __abstract__ mark #83

ivirabyan opened this Issue Jun 8, 2012 · 2 comments

3 participants

class User(db.Model):
    __abstract__ = True
    id = Column(Integer, primary_key=True)

class Manager(User):
    name = Column(String)

This code must declare only one table manager, with two fields id and name. But Flask-SQLAlchemy doesn't generate __tablename__ for class Manager, because it doesn't have a primary key field. So, accessing Manager.__tablename__ results in user, which obviously not what I want.


Wow. I can't believe this is still an issue in Dec 2014. I experience the same behavior when attempting to use a custom abstract base class for my models. The correct __tablename__ value is not picked up from the non-abstract class unless __tablename__ is defined on the class.


Thanks for your pull request.

@immunda immunda closed this Dec 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment