I wish to have a “stateful” Dash application. In my case, I wish to have a large dataframe in the server-side that I can access depending on the client’s input.
For example, consider an app where the user just gives the row number, and then the app just displays that row from the server-side dataframe.
In the docs it says that Dash apps are stateless, and that global variables will break the dash application.
How can this be achieved without global variables?
You can use a serverside caching mechanism (disk storage, Redis, etc.), either directly or via a serverside output,
I liked the “ServersideOutputTransform” option. Strange that Dash doesn’t have this option built-in. Something like “ServerSideStore” that allows using the different mechanisms to access data that’s unavailable in the client side.
I believe the reason that this functionality was left out of the main Dash code base was to keep the server stateless (which yields certain advantages). But I am happy that you like my workaround
I think that if the data is saved per session / page load, then the server can still be considered stateless. However, the logic here (especially expiration) might be complicated, so maybe that’s why it doesn’t exist.