i have a working app that uses a dropdown menu to allow users to select from a range of different plots for a reporting dashboard, and everything is working well, but i need some help understanding how to properly use the dcc.Interval functionality.
the use case is as follows: i have a cron job (ubuntu) running 4 times a day to do some ETL work (parsing log files) and then batch updating two database tables. in my dash app, this database is queried to make two dataframes which are passed to an update_graph() function when a dropdown item is selected. i would like to use the dcc.Interval to auto-update these dataframes, but i do not want the dataframes to update every time a dropdown item is selected. so i have two questions:
- how can i access the n_intervals counter of the dcc.Interval so i can compare the current value to the last value to trigger the database queries? it seems this would require keeping a global variable corresponding to the old value, so maybe this is not the right way to think about this?
- i’ve found some posts claiming the way to do this is to either write the updated dataframes to disk and read them as part of the callback, or to pass them around as a local data object… is this really the best method?
thanks!
liam