You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We'll need a variation of the second gist to handle scenario 2a: record a dirty flag in application context (_app_ctx_stack.top) and send all queries to master for as long as the flag remains. We also need to debug and resolve the problem with self._flushing, as reported in the various comments on the first gist.
Coaster provides a copy of Flask-SQLAlchemy's SQLAlchemy object in the coaster.db module (not the db instance that is also provided). Our version of the subclass could reside here and be available for importing to apps.
The text was updated successfully, but these errors were encountered:
For performance reasons, apps like Hasjob in production should have separate master and replica databases, running on different nodes:
a. …unless we just wrote to master, in which case read from master
Here are a couple of gists showing how this can be achieved transparently with Flask-SQLAlchemy:
We'll need a variation of the second gist to handle scenario 2a: record a dirty flag in application context (
_app_ctx_stack.top
) and send all queries to master for as long as the flag remains. We also need to debug and resolve the problem withself._flushing
, as reported in the various comments on the first gist.Coaster provides a copy of Flask-SQLAlchemy's
SQLAlchemy
object in thecoaster.db
module (not thedb
instance that is also provided). Our version of the subclass could reside here and be available for importing to apps.The text was updated successfully, but these errors were encountered: