Right now user has to specify __tablename__ = None to disable setting new name. SQLAlchemy extension to Flask does simple check to see if class dictionary has columns with primary_key set to True. This checks doesn't cover all possible cases, but works for the most used one.
Cases where Flask fails:
- Columns properties
- Composite properties
- Declared attributes
- Primary key defined in
__table_args__
Some of them are important to us since we use factories that wrap all collumns.
It's not obvious how to handle classes that inherit primary key from abstract class (__abstract__ = True).