Hi Everyone! I am new to using Streamlit and have a question related to Streamlit app timeout / sleep timer. I created a Streamlit app through my Snowflake database, and it becomes inactive after approximately 15 minutes of being open. Even if i am actively using the app, it still will refresh and become inactive after the 15 minutes. Does anyone know how to fix this? I tried following the instructions in this article ( Additional Streamlit in Snowflake features | Snowflake Documentation but it didnt work. Thanks in advance!
Hi @Malia
I tried custom sleep and it worked without any problems. Did you place the config file in the correct location? It needs to be placed in /.streamlit/config.toml .
For example, in my environment it worked by placing it as follows:
Or, if you uploaded your config.toml with SnowSQL, note that auto_compress must be false! (I often make this mistake myself😂) Also note that you will probably need to restart your app (simply reload your browser) after uploading the config file.
Hi Toru!
Thank you so much for getting back to me!
Ohh that makes sense. I think my problem is that I dropped the file directly into my stage without it being contained within the .streamlit folder.
Problem is that I have tried to upload it contained inside the .streamlit folder, but it tells me that folders are not allowed to be uploaded? Did you upload the file using a SQL Put command or just using the “+ File” button in the Stage itself? I tried using the put command but it always returns an error. I think its related to the stage name needing quotations around it?
Example of the query:
PUT ‘file:///C:.….….streamlit\config.toml’
@UMP_DB_PROD.FINANCE_SCHEMA.“F4G174KISCNOV7HI (Stage)”/.streamlit/
OVERWRITE = TRUE
AUTO_COMPRESS = FALSE;
Any way you can help me figure out what is going wrong? I would really appreciate it!!
Hi @Malia
I uploaded it using the [+] button on the stage. Surely, this is not a little straightforward, but you just specify the folder as shown below and upload the config.toml by itself.
I hope this works!
Omg, duh!! Hahah. Oops. Thank you so much!! Appreciate you taking the time to explain it to me. I’m new to coding and Streamlit, so this is all very new to me.
Hi,
I’ve added the following to the config.toml
file in my Streamlit app:
[snowflake]
[snowflake.sleep]
streamlitSleepTimeoutMinutes = 5
With this setting, I notice that the UI session ends as expected after 5 minutes of inactivity. However, in Snowflake’s history, the query executed by the Streamlit app continues to run even after the UI session has ended.
Additionally, I’m finding the default timeout behavior confusing. When I remain on the page without interacting, the query sometimes runs for more than 15 minutes. I’m not entirely sure what “inactivity” means in this context. Could you help clarify how this setting works and why the query keeps running on Snowflake despite the UI timeout?
Hi,
I am assuming that you have your warehouse auto-stop time set to 10 minutes (default). Therefore, adding up with Streamlit’s auto-stop, I am assuming that the warehouse will stop if not used for 15 minutes. How about this?
If that is the case and you have warehouse operating privileges you can set the auto-stop time of the warehouse to 1 minute, 5 minutes, etc.
alter warehouse {compute_warehouse_name} set AUTO_SUSPEND=60;