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.