Assume table has three columns: username, password and no_of_logins.
When user tries to login, it’s checked for an entry with a query like
user = User.query.filter_by(username=form.username.data).first()
If password matches, he proceeds further. What I would like to do is count how many times the user logged in. Thus whenever he successfully logs in, I would like to increment the no_of_logins field and store it back to the user table. I’m not sure how to run update query with SqlAlchemy.
1 Answer