I have an module in my program that increments the no of logins(login_count) by 1 using textual SQL but on the same transaction, when I try to retrieve the no of logins using ORM, I still get the previous value.
stmt = "UPDATE user SET login_count = login_count + 1 WHERE userid = {}".format(id)
session.execute(stmt)
user = session.query(User).get(id)
print(user.login_count)
But when I change the query to Textual SQL, I am able to get the updated value. Does Textual SQL create a separate transaction?
stmt = "SELECT * FROM user WHERE userid = {}".format(id)
user = session.execute(stmt)
print(user.login_count)