Automatically update data fetched from SQL (no rerun)

Hi @Pedro_Trama,

My best guess is that if you rerun the app and the data doesn’t refresh, you might need to tweak the ttl so that your data cache expires. For example, if you’re using st.connection st.connection - Streamlit Docs, you might pass ttl=timedelta(minutes=10) to make the cache expire after 10 minutes.

However, that won’t make your app automatically rerun, it will just mean that if it does rerun, it should fetch new data if 10 or more minutes have passed since the last run.

If you want to make your app automatically fetch new data every few minutes, you might use the new experimental_fragment ⚡️ Launched in 1.33: st.experimental_fragment, which has a run_every argument that makes a function rerun on a schedule.