What does scoping to request instead of thread mean exactly in versions 3+? #1376
-
Hey. The current pattern we use in v2 for managing sessions is to create a single |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Request contexts (and app contexts) are essentially scoped the same, because each request is handled by one thread. Nothing should have changed for you. That said, from your questions it sounds like you're doing a lot of plain-SQLAlchemy stuff rather than using Flask-SQLAlchemy typical patterns. You'd probably be better served by Flask-SQLAlchemy-Lite: https://flask-sqlalchemy-lite.readthedocs.io/en/latest/ |
Beta Was this translation helpful? Give feedback.
Request contexts (and app contexts) are essentially scoped the same, because each request is handled by one thread. Nothing should have changed for you.
That said, from your questions it sounds like you're doing a lot of plain-SQLAlchemy stuff rather than using Flask-SQLAlchemy typical patterns. You'd probably be better served by Flask-SQLAlchemy-Lite: https://flask-sqlalchemy-lite.readthedocs.io/en/latest/