Reputation: 14651
I have a flask application spread across modules with blueprints. Each module/blueprint has its own models.py file where models are defined.
With my desktop applications, using SQLAlchemy API directly, I would subclass object
to define a Base
class with some columns (ex: id
, date_created
..), which then would serve as my declarative base (ex: Base = declarative_base(cls=Base)
).
flask-SQLALchemy
's db.Model
so that I can use it as a Base with default columns which I want all tables to have?Upvotes: 3
Views: 2348
Reputation: 14210
Simply set __abstract__
to True
:
class BaseModel(db.Model):
__abstract__ = True
Upvotes: 10