Streamlit MultiSelect Malfunction: Help

I am seeking some help on an issue I am having with building a simple “app” that filters queries based on a hierarchy (Department-SubDept-Class) I would like to add in “Merchant” which would come BEFORE department in the hierarchy, and also add in “Store” which would be used to filter but has no set order in the hierarchy.

When trying to work with merchant or store in Multi Select I can populate the query and the widget but when selecting my streamlit malfunctions and it doesn’t filter anything. I am not getting an error but a warning:

UserWarning: pandas only supports SQLAlchemy connectable (engine/connection) or database string URI or sqlite3 DBAPI2 connection. Other DBAPI2 objects are not tested. Please consider using SQLAlchemy.
df = pd.read_sql(query,conn)

see code: GitHub - jrodenberg1/demandplanning

I have since pulled Merchant and Store out of any multiselect as they aren’t working but the functions are the same. All queries in the code pull the desired result.

Hi @Jack_Rodenberg, welcome to the forum!

There’s a lot going on in that app – could you please simplify down to a reproducible code snippet which demonstrates the issue you are facing?

If you want others on the forum to be able to test it and see the issue you are facing, I would recommend starting by creating a static set of data, and testing your app with that, rather than using an external database that we won’t be able to access.

sure thing, i will adapt it to take a dataframe in hopes of reproducing what is happening. I am fairly confident that it is something to do with the structure of my loops (which I will include) or a small bug, I am not the best programmer.

Talk soon,

Thanks

Additionally, @Jack_Rodenberg, this awesome component may interest you: ( New component: streamlit-condition-tree, an elegant way to filter a DataFrame & build a query - :jigsaw: Streamlit Components - Streamlit)

Cheers