Create a WHERE Clause builder


I want to create a WHERE Clause builder to the user can build and add WHERE clause to and SQL.

I was thinking about adding

1- Select box for the available columns in the selected table
2- Select box for the operators like β€œ=”,β€œ!=”,β€œ>” and so on.
3- Input text for the value
4- Button to add the condition

Now I’m stuck in where and how to store the values when the user click the add button assuming that he can add more than one condition and can also choose either β€œAND” or β€œOR” in case of multiple conditions. Also how to delete conditions from the list?

Python version is 3.11
Streamlit version is 1.30.0


Could you post your sample code?