YourModel.query.with_for_update().get(id) #This locks the row until db.session.rollback() #or db.session.commit() #is called