Hello, I'm trying to automate a backref update. Basically, when a child model is inserted or updated I want the parent model's "updated_at" column to mutate. The value should be the approximate time the user-child-model was updated. The updated_at value would not have to match the created_at/updated_at value on the child. It would just need to mutate to a new time.
class UserModel(db.Model): updated_at = db.Column(db.DateTime, default=db.now, onupdate=datetime. now) class UserChildModel(db.Model): user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False ) user = db.relationship('UserModel', backref='children') user = UserModel() save(user) print(user.updated_at) # x child = UserChildModel(user_id=user.id) save(child) print(user.updated_at) # y (value changed) Hopefully this pseudocode is sufficient. I'm wondering if there is an option I can specify on the orm.relationship factory. Or will I need to define an event? Thanks! -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/490bfcd2-4ebd-4df3-98a8-516caeacbd6a%40googlegroups.com.