flask-sqlalchemy-session icon indicating copy to clipboard operation
flask-sqlalchemy-session copied to clipboard

Fix for Werkzeug 2.1.

Open schettino72 opened this issue 2 years ago • 6 comments

Fix #14

I have not tested it with greenlets. Seems that should be set directly with SQLAlchemy session factory.

Any chance this get released? It seems not really maintained for a while...

schettino72 avatar Apr 12 '22 15:04 schettino72

Thanks for the PR. I am not sure yet what the best solution for this is, I was thinking to extend the API to allow passing in a custom scopefunc and at the same time use a sane default such as the following to maintain the old behavior, which is also the desired behavior

try:
    from greenlet import getcurrent as _scopefunc
except ImportError:
    from threading import get_ident as _scopefunc

Is this doable with just the session factory?

dtheodor avatar Apr 12 '22 19:04 dtheodor

Sorry for delay.

I thought the scopefunc was a parameter for sessionmaker...

SQLAlchemy uses a different "registry" for default/threads, so if no greenlets package I leave scopefunc as None. I run the tests with greenlets installed and it looks ok.

schettino72 avatar Apr 25 '22 13:04 schettino72

Is this close to being merged in?

npcole avatar Jun 30 '22 01:06 npcole

Another user here affected by the same bug. Is this close to being merged in?

vincent-olivert-riera avatar Sep 17 '22 11:09 vincent-olivert-riera

Also affected by this bug and waiting on this merge, is there anything blocking this from being merged in?

simon-ricketts avatar Oct 12 '22 10:10 simon-ricketts