In src/fastapi_server/app/api/dependencies/database.py you have a function that redeclares the sessionmaker each time you call it. The purpose of the sessionmaker is to have the settings for all sessions defined in a single place. You can move it to database.py like how the FastAPI tutorial does.