The current examples for database adapters show
hash_funcs being passed to
st.cache() to trick streamlit’s caching mechanism into doing “the right thing” with either the whole database connection instance or some of its internals (I think the Postgres example does this for RLock?).
Wouldn’t it be better/clearer to explicitly have a way to streamlit-wide not cache certain types of object?
For example, hypothetically:
from clickhouse_driver import Client st.never_cache(Client)
This would indicate to streamlit that objects of the specified type should just be completely ignored: don’t try and cache or hash them, just accept that they will be there when the script is run and can be used inside functions that are cached, etc.
Maybe I’m doing something wrong? See InternalHashError: unhashable type: 'bytearray' when using clickhouse_driver and caching · Issue #3392 · streamlit/streamlit · GitHub for details.