File size: 949 Bytes
962e128
 
 
 
 
 
3eebb0d
962e128
 
 
 
 
 
 
 
3eebb0d
962e128
 
 
d96db7a
962e128
 
 
 
 
 
 
 
 
129281c
8de66dc
129281c
962e128
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import duckdb
import streamlit as st

from config import DEFAULT_ICON
from shared_page import common_page_config

from queries.nflverse.github_data import load_assets, get_current_tables


def get_page():
    page_title = "Data Loader"
    st.set_page_config(page_title=page_title, page_icon=DEFAULT_ICON, layout="wide")
    common_page_config()
    st.title(page_title)

    current_tables_list = get_current_tables()

    if st.button("Refresh Data"):
        load_assets()
        st.rerun()

    if selected_table := st.selectbox("Describe a table:", current_tables_list, index=0):
        describe_df = duckdb.sql(f"DESCRIBE {selected_table}").df()
        st.dataframe(
            describe_df,
            hide_index=True,
            use_container_width=True,
        )

        if st.checkbox("Explore data"):
            st.dataframe(duckdb.sql(f"SELECT * FROM {selected_table} LIMIT 50").df())


if __name__ == "__main__":
    get_page()