Problem: Recalculate email hash when it changes. I go to the forehead:
class User(db.Model): __tablename__ = "users" id = db.Column(db.Integer, primary_key=True) nickname = db.Column(db.String(64), index=True, unique=True, nullable=False) email = db.Column(db.String(120), index=True, unique=True, nullable=False) email_hash = db.Column(db.String(32)) @property def email(self): return self.email @email.setter def email(self, email): #считаем хэш self.email_hash=hash self.email = email The solution is to change the name of the attribute to _email so that it does not conflict with the name of the property, but this method is not acceptable, since the class is a display of real tables in which underscores and other shamanism with names are not allowed.