Timed data actualisation with a multipage app


i want to have a timed data actualisation for the dataframes for each of my sides. But im not sure how to solve it. Should I make for each page a separated callback which makes two queries and return both dataframes? And should I make this callback in the main app or in the source code of each site?

Thanks in advance.

Greetings Mae

And i want that all selects/dataframes are executed when i started the app. So i want all dataframes doesnt matter if the first page ist opened or the other.

Greetings Mae

Hi Mae,

Could you please provide a short example of how your application looks like?

Besides, could you add some words on what you mean by “time data actualisation” for the dataframes? Am I correct to say that you want the dataframes to refresh after a certain time interval, or should they refresh at each page load (or when the app launched)?

Hi jlfsjunior,

i have the main app which conatins the nav bar and a callback to navigate through

and separate two sites with each two callbacks for the table and the graph.

i dont want to have that the queries will be triggered every time i load or reload the page so only after a period of time should be executed the query for example every day at 22pm.

And thanks for your reply.

Greetings Mae

Sure, thanks for the clarification.

How are you deploying (or intend to deploy) your application? One simple solution would be to import the data in the global scope of the app and restart the service at 22pm to update the data.

Probably the best solution would be to use server-side caching, as demonstrated in this post: Show and Tell - Server Side Caching

It can be a bit more complicated to implement, but I think it is exactly what you would need. You could also consider clientside caching with dcc.Store, but then the queries are triggered for each browser session every day and the updates are not reusable across different users (contrary to the server-side version).

1 Like

The app should run on a computer which is only reachable from the internal network. i tested it already and it´s working fine. The operating system is linux and the app runs on a windows 10 vm and as i said it is only reachable in the internal network. I was thinking about to store the datas on a local db to optimize the speed of my queries but i havnt done it yet.

i dont think that storing the datas in the browser cache is a good solution cause with the time the data size will be bigger and bigger.

cause first i made alot of calculations in my queries like determine the week of a date and stuff like that but ithe query tooks20 seconds so i decided only to get the raw datas and work with it in the app itself so my querytimed lowered from 20 seconds to 3 but to create and optimize the frame it tooks 6 seconds so i have an optimization of 10 seconds. so i was thinking about the same like you said creating a local DB to get with a query all the datas in the shape i need to get a better performance.

Greetings Mae

1 Like