@st.experimental_connection && @st.cache_resource

Summary

I’m using these Streamlit function to interact with MySQL DB:

  • @st.cache_resource()
  • @st.experimental_resource

I’m always getting a spinner writing: Running sql.query(...). while interact with DB

This is my function:

@st.cache_resource(show_spinner=False)
def get_connection(db_name = "DB_NAME"):
    return st.experimental_connection(db_name, type="sql", autocommit=True)

Expected behavior:

Prevent from the spinner and its text to show up

Actual behavior:

pinner and its text show up on interaction with DB


Thanks alot

Using @st.cache_resource(show_spinner=False) has no effect on code that explicitly shows a spinner.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.