Flask-SQLAlchemy 3 breaks detection
revmischa opened this issue · comments
jetbridge/flask-sqlalchemy@7ff93c1#commitcomment-20686450
This is not a safe interface to get the connection stack.
This happens with Flask-SQLAlchemy 2.2 as well (I can't find a version 3).
@aromanovich heads up Flask-SQLAlchemy new version got released; this needs fixing
If I am understanding this correctly this commit made flask-sqlalchemy only use the app context for the session. During that refactor they removed the connection_stack
.
Ultimately, SQLAlchemy orm.scoping.scoped_session
needs to be able to identify the session which it does by hashing the return value of scopefunc
. Historically this is the __ident_func__
on _app_ctx_stack
or _request_ctx_stack
. Since 2.2 dropped support for _request_ctx_stack
there is no need to reference the global, _app_ctx_stack
is a sufficient default.
I will submit a patch to remove the need for connection_stack
and just fall back to the _app_ctx_stack
.