# Conditional content based on selected section
if st.session_state['selected_section'] == "Data Upload":
def session_reset():
st.session_state['sql_data']=False
st.session_state['database_upload']=False
st.session_state['github_data_fetch']=False
if 'github_data_fetch' not in st.session_state:
session_reset()
if not st.session_state['github_data_fetch']:
def handle_github_data():
# GitHub URL input
sub_header_data_upload_section=st.empty()
github_input_placeholder = st.empty()
local_path_input_placeholder = st.empty()
enter_description=st.empty()
sub_header_data_upload_section.subheader("Please provide the following inputs to fetch the data:")
github_url = github_input_placeholder.text_input('GitHub URL to fetch data')
local_path = local_path_input_placeholder.text_input("Local path to download data")
enter_description.text(f'Press Enter..')
# Once inputs are received, hide the input fields
if github_url and local_path:
enter_description.empty()
progress_bar=st.empty()
progress_bar.progress(0)
for i in range(100):
time.sleep(0.01)
progress_bar.progress(i+1)
success_message=st.empty()
progress_bar.empty()
success_message.success("Data fetched successfully..!")
time.sleep(1)
success_message.empty()
github_input_placeholder.empty()
local_path_input_placeholder.empty()
sub_header_data_upload_section.empty()
st.session_state['github_data_fetch']=True
st.session_state['sql_data']=False
handle_github_data()
if st.session_state['github_data_fetch'] and not st.session_state['sql_data']:
def handle_sql_connection():
sub_header_data_upload_section=st.empty()
sql_username_placeholder=st.empty()
sql_password_placeholder=st.empty()
enter_description=st.empty()
sub_header_data_upload_section.subheader("Please provide the following inputs to connect sql server:")
sql_username = sql_username_placeholder.text_input("SQL Username")
sql_password = sql_password_placeholder.text_input("SQL Password", type="password")
enter_description.text(f"Press Enter..")
if sql_username and sql_password:
enter_description.empty()
progress_bar=st.empty()
progress_bar.progress(0)
for i in range(100):
time.sleep(0.01)
progress_bar.progress(i+1)
success_message=st.empty()
progress_bar.empty()
success_message.success("Connection establishment success..!")
time.sleep(1)
success_message.empty()
sql_password_placeholder.empty()
sql_username_placeholder.empty()
sub_header_data_upload_section.empty()
st.session_state['sql_data']=True
st.session_state['database_upload']=False
handle_sql_connection()
if st.session_state['sql_data'] and not st.session_state['database_upload']:
def handle_sql_data():
sub_header_data_upload_section=st.empty()
variable_cotainer=st.empty()
enter_description=st.empty()
progress_bar=st.empty()
sub_header_data_upload_section.subheader("Please provide the below input to create/use database:")
database_name = variable_cotainer.text_input("Database Name")
enter_description.text(f'Press Enter..')
if database_name:
enter_description.empty()
sub_header_data_upload_section.empty()
variable_cotainer.empty()
progress_bar.progress(0)
for i in range(100):
time.sleep(0.01)
progress_bar.progress(i+1)
success_message=st.empty()
progress_bar.empty()
success_message.success('All done.. Data uploaded to database..!', icon="✅")
success_message=st.empty()
session_reset()
# variable_cotainer.empty()
handle_sql_data()
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.