databases icon indicating copy to clipboard operation
databases copied to clipboard

session manager/ session maker

Open eddyizm opened this issue 2 years ago • 0 comments

I see the await database.connect() used but is that the equivalent to sqlalchemy's orm.sessionmaker?

Do I just open a new connection every time up to the defined limit and databases handles them in the connection pool?

I do have the connection and disconnection at start up - but seem to have to call the connect function again as a dependency whenever I try to execute a query elsewhere in the code

@app.on_event("startup")
async def startup():
    await database.connect()

@app.on_event("shutdown")
async def shutdown():
    await database.disconnect()

eddyizm avatar Nov 17 '23 04:11 eddyizm