From e2c8c96e2cacf3b220988fefc71c7f78021e337a Mon Sep 17 00:00:00 2001 From: Julian Teichgraeber Date: Mon, 29 Jan 2024 16:00:29 +0000 Subject: [PATCH] enable other authentification methods --- pyproject.toml | 2 +- .../streamlit/pages_wrap/page1_Data_Loading.py | 7 +++++-- tw_experimentation/streamlit/streamlit_utils.py | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fe9fffa..1c2c114 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "tw-experimentation" -version = "0.1.2.3" +version = "0.1.2.4" description = "Wise AB platform" authors = ["Wise"] readme = "README.md" diff --git a/tw_experimentation/streamlit/pages_wrap/page1_Data_Loading.py b/tw_experimentation/streamlit/pages_wrap/page1_Data_Loading.py index a802e8b..7c83ced 100644 --- a/tw_experimentation/streamlit/pages_wrap/page1_Data_Loading.py +++ b/tw_experimentation/streamlit/pages_wrap/page1_Data_Loading.py @@ -111,8 +111,10 @@ def page_1_data_loading(snowflake_connector=SnowflakeIndividualCredentials()): st.session_state["snowflake_" + config_variable], disabled=not (enter_credentials or restart_snowflake), ) - - if st.button("Fetch data from snowflake"): + if not st.session_state["fetch_from_snowflake_button"]: + if st.button("Fetch data from snowflake"): + st.session_state["fetch_from_snowflake_button"] = True + if st.session_state["fetch_from_snowflake_button"]: account_configs = { config_variable: st.session_state["snowflake_" + config_variable] for config_variable in st.session_state[ @@ -136,6 +138,7 @@ def page_1_data_loading(snowflake_connector=SnowflakeIndividualCredentials()): source_table=st.session_state["table"], ) st.session_state.has_snowflake_connection = True + st.session_state["fetch_from_snowflake_button"] = False if st.session_state["df_temp"] is not None: st.divider() diff --git a/tw_experimentation/streamlit/streamlit_utils.py b/tw_experimentation/streamlit/streamlit_utils.py index eb7aff1..aba492d 100644 --- a/tw_experimentation/streamlit/streamlit_utils.py +++ b/tw_experimentation/streamlit/streamlit_utils.py @@ -86,7 +86,7 @@ def load_table( select * from {source_database}.{source_schema}.{source_table} """ df = pd.read_sql(sql_query, self.connection) - + st.session_state["fetch_from_snowflake_button"] = False return df def close_connection(self): @@ -178,6 +178,7 @@ def initalise_session_states(additional_params: Optional[Dict] = dict()): "ed": None, "data_loader": PullAndMatchData(), "snowflake_connection": None, + "fetch_from_snowflake_button": False, "df_temp": None, "is_defined_data_model": False, "evaluate_CUPED": False,