Spaces:
Running
Running
| import streamlit as st | |
| from config import DEFAULT_ICON | |
| from shared_page import common_page_config | |
| from dbt_data_client import run_dbt_build, get_current_tables, execute_db_command_df | |
| def get_page(): | |
| page_title = "Data Loader - dbt" | |
| st.set_page_config(page_title=page_title, page_icon=DEFAULT_ICON, layout="wide") | |
| common_page_config() | |
| st.title(page_title) | |
| if st.button("Refresh Data"): | |
| run_dbt_build() | |
| current_tables_list = get_current_tables() | |
| if selected_table := st.selectbox("Describe a table:", current_tables_list, index=0): | |
| describe_df = execute_db_command_df(f"DESCRIBE {selected_table}") | |
| st.dataframe( | |
| describe_df, | |
| hide_index=True, | |
| use_container_width=True, | |
| ) | |
| if st.checkbox("Explore data"): | |
| st.dataframe(execute_db_command_df(f"SELECT * FROM {selected_table} LIMIT 50")) | |
| if __name__ == "__main__": | |
| get_page() | |