Postgresql – sqlalchemy listens_for() doesn't trigger
I have working listens_for function, which inserts LoadHistory object before updating Load: @event.listens_for(Load, 'before_update') def before_update_load(mapper, connection, target): current_load_select = select(load_fields).where(Load.id == target.id) insert_history = insert(LoadHistory).from_select(load_history_fields, current_load_select) connection.execute(insert_history) And the task is to have similar function but which will insert…