Hello Experts,
Below is my code:
### Connect to Snowflake ###
#@st.cache
@st.experimental_singleton()
def create_session():
with open('creds.json',encoding='utf-8') as f:
cp = json.load(f)
conn = snowflake.connector.connect(
user=cp["user"],
password=cp["password"],
account=cp["account"],
warehouse=cp["warehouse"],
database=cp["database"],
role=cp["role"],
schema=cp["schema"]
)
return conn
curr_sess = create_session()
df_database=pd.read_sql("select * from cycle_time",curr_sess)
But it is very slow, every time, I select different options in radio button, or from sidebar, it reruns whole thing. how to cache above connection ?