YFDashboard / src /pages /98_Load_Data copy.py
Jon Solow
Copy get_current_tables to dbt_data_client to remove incorrect dep path
ddf7165
raw
history blame
1.09 kB
import streamlit as st
from config import DEFAULT_ICON
from shared_page import common_page_config
from dbt_data_client import get_db_conn, run_dbt_build, get_current_tables
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)
with get_db_conn() as duckdb_conn:
current_tables_list = get_current_tables(duckdb_conn)
if st.button("Refresh Data"):
run_dbt_build()
if selected_table := st.selectbox("Describe a table:", current_tables_list, index=0):
with get_db_conn() as duckdb_conn:
describe_df = duckdb_conn.sql(f"DESCRIBE {selected_table}").df()
st.dataframe(
describe_df,
hide_index=True,
use_container_width=True,
)
if st.checkbox("Explore data"):
with get_db_conn() as duckdb_conn:
st.dataframe(duckdb_conn.sql(f"SELECT * FROM {selected_table} LIMIT 50").df())
if __name__ == "__main__":
get_page()