Hi all, is there a feature or pattern for adding a listener that is to be executed (at most) once? For example, say you want to send an email when user is created and the session is committed. If event.listen() supported a "once" boolean parameter, this could be expressed as:
def email_user(email_address, message): ... ... if valid_data: new_user = User(**valid_data) db.session.add(new_user) # send an email to new_user after committing event.listen(db.session, "after_commit", once=True, # hypothetical parameter lambda session: email_user(new_user.email, "welcome {}!".format(new_user.name)) Thanks, George -- 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 post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.