Skip to content

Commit

Permalink
Merge pull request #15 from transferwise/snowflake-generalisation
Browse files Browse the repository at this point in the history
enable other authentification methods
  • Loading branch information
julianteichgraber authored Jan 29, 2024
2 parents 3f8fb15 + e2c8c96 commit d76e00d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
7 changes: 5 additions & 2 deletions tw_experimentation/streamlit/pages_wrap/page1_Data_Loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -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[
Expand All @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion tw_experimentation/streamlit/streamlit_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d76e00d

Please sign in to comment.