-
Notifications
You must be signed in to change notification settings - Fork 86
Description
I have deployed the Streamlit sample app as Databricks app to my workspace. The app was working fine for a couple of days. However, after some time I got the following error when interacting with delta tables (I slightly plaxed with the layout of that app, but the code is taken directly from the sample):
I wasn't able to find the root cause of the error, but I had to re-deploy my app (again, using exactly the same code) and it started to work again as expected. My assumption is (I dont know how I can proof it) that is may be related to connection resource caching - as other people have also faced issues with long-open sql connections: databricks/databricks-sql-python#23 (comment)
As an additional info: I'm using a serverless SQL warehouse with auto-shutdown of 10 minutes. Not sure if this plays will with a longer idle time on the app and the connection caching.
Code in question is here:
databricks-apps-cookbook/streamlit/views/tables_read.py
Lines 23 to 29 in b09cfb3
| @st.cache_resource | |
| def get_connection(http_path): | |
| return sql.connect( | |
| server_hostname=cfg.host, | |
| http_path=http_path, | |
| credentials_provider=lambda: cfg.authenticate, | |
| ) |
