I am currently facing an issue regarding “caching” some data into my dash application.
The data that I need to store within my application is currently in the form of: a dictionary of pandas DataFrames.
Here is a description of what it looks like:
These data come from a custom python class that I made, handling all the computationally expensive steps. It is instantiated from an initial callback from the user selecting an input file from a drop-down list. Therefore, I do not know ahead what the data shape will be (how many blocks, and what columns in the different DataFrame(s) there will be.)
The general idea of my application is as follows:
1: User selects a file name from a drop-down menu
A: This triggers my custom python class to cache the data
B: Generates some default plots
2: User selects a date range from a calendar:
A: Updates the plots from 1.B by accessing the data cached in 1.A
My question is, how can I store such a data-structure in dash. I have looked at dcc.Store but the complete JSON data structure does not seem suitable for what I want to do.
Thank you for your answer. I have had a look at it and it seems that the dash_extensions.callback is deprecated and has been removed from dash_extensions new version version: 0.0.60.
Maybe I missed something in the new documentation that could still do the job?
I currently do not have an implementation as I am completely lost with the dash library structure. It seems that I am supposed to use the ServersideOutput module which I can’t find anywhere.
When trying to import it from enrich I get the following:
> ImportError: cannot import name 'ServersideOutput' from 'enrich' (/usr/lib/python3.9/site-packages/enrich/__init__.py)
Has this been implemented somewhere else under a different name?
Sorry to sound stupid here but I simply do not understand it.