Hi All,

Given this async function (asgi middleware, as it happens):

@app.middleware('http')
async def make_db_session(request: Request, call_next):
    request.state.db = Session()
    response = await call_next(request)
    request.state.db.close()
    return response

Would either the call to Session, which is a sessionmaker, or db.close(), be expected to block? I can't remember whether instantiating a session will open a network connection, or whether close will similarly do network io, so thought I'd ask...

Chris

--
SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/67f180de-a6c1-a28b-8c6f-b850b3775519%40withers.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to