I’m using Flask with its SQLAlchemy extension. I need to define several model classes, which will create tables in MySQL database. The tables will only differ by name, all the field names/datatypes in them will be identical. How do I define the classes for all those tables? I’m thinking of some inheritance, but I’m not quite sure how exactly would I do that.
I’m using Flask with its SQLAlchemy extension. I need to define several model classes,
Share
Just define all your columns in a mix-in class: