Integration with flask With this code each of view function you will define will be wrapped with db_session so you should not care about them. Example You can run another example to check it