Hi all,
Is it possible to share the same dataframe across all pages so that the ETL only happens once?
I see dcc.store is not recommended for bigger data.
Any help will be appreciated.
AIMPED
November 28, 2022, 1:08pm
2
HI @EhanGreens133 , welcome to the forums.
You can use a dcc.Store server side:
Results form the forum search (extract):
Thanks @johndy
Let me give you a tip:
If you are using dcc.Store let implement server side caching callback, it’s very easy to do because use the same dcc.Store and you only need to make two minor changes in your code, just import the library:
from dash_extensions.enrich import Dash, ServersideOutput, Output, Input, State, Trigger
And replace the Output to the dcc.Store with:
ServersideOutput(
It uses the same Inputs, and manage all the info in the server side.
Thanks @Emil for such …
Based on inputs from @fohrloop and @chriddyp , i have come up with a new syntax (available in dash-extensions 0.0.28). The performance should be the same, but the syntax is simpler (at least that is the intention). Here is the benchmark example using the new syntax,
import datetime
import dash_core_components as dcc
import dash_html_components as html
import numpy as np
import pandas as pd
from dash_extensions.enrich import Dash, ServersideOutput, Output, Input, State, Trigger
# Drop down opti…
In recent versions of dash-extensions all enrichment functionality, including server side caching, has been moved to the enrich module. You can find an example using current syntax in the examples folder,
If you are already using non-json serialization, that means that the server side caching is working as intended. The default storage used is your local disk. For GB size data that might become a little slow depending on your disk speed. Besides getting a faster disk (say, an PCIe NVMe SSD if…
1 Like
Hi,
How can I convert
app = DashProxy(transforms=[ServersideOutputTransform()])
as in the example to:
app = dash.Dash(name , use_pages=True, external_stylesheets=[dbc.themes.SPACELAB])
As is the case with my multi page app?
AIMPED
November 28, 2022, 6:41pm
4
You can use the same arguments as far as I know, did you try?
app = DashProxy(
name,
use_pages=True,
external_stylesheets=[dbc.themes.SPACELAB],
transforms=[ServersideOutputTransform()]
)
@AIMPED , Thank you let me try that.
Do you know of any limitations, dataframe size?
AIMPED
November 28, 2022, 7:54pm
6
@EhanGreens133 , no I don’t know about any limitations.
Emil
November 28, 2022, 9:05pm
7
The only limit is what the backend can handle. Using the filesystem (which is the default), you should be able to work with GB-size dataframes, assuming you have a fast disk with enough free space.
1 Like