My first day of using Streamlit, and honestly loving it, so please be easy if I don’t understand some basic, though I have done my homework to search the solution. I am trying to get data dynamically into the streamlit_option_menu
and could not find an example any where. I have multiple database tables and one of the table has the list of topic which I want to place as the menu items using streamlit_option_menu.
I know the options_menu
accepts list of strings as an input, and I have tried multiple ways pandas dataframe, cursor.fetchall()
etc. but somehow it doesn’t work as expected. I have a simple table of sd_id
and sd_names
, and I want to click on sd_names
(in the menu) that can then run set of queries to fetch what I want from the relational database.
Any direction or input is highly appreciated.
NB: I don’t have much to share in terms of sample code but I have got the following data coming from maria_db
db_topic = cursor.fetchall()
df = pd.DataFrame(db_topic, columns=cursor.column_names)
I want to place it in the options menu instead of manully typing like in the example below
with st.sidebar:
selected = option_menu("Main Menu", ["A","B","---"],
)
selected
This one gives me the menu options but also has sd_id in front of it and I cannot select any items in the menu
with st.sidebar:
selected = option_menu("Main Menu", db_topic,
)
selected