Create 3 dependent (related) selectbox using streamlit

i have a streamlit app that is connected to the database (SQL server ) where i have form that allow the user to insert values and this form includes 3 selectbox that are related between each other (3 columns from the same table), where based on the selection of the first selectbox the second one display the list, and the same for the relation between second and third.

Until now i am able to create the 3 selectbox but with no relation between each other.

code:


patternt = r"(?<=')[^,]+?(?=')"
query_street =(
                   r"select distinct street "

                   r"from dbo.info"

                      )    
rows_street = cursor.execute(query_street).fetchall()
rows_street = re.findall(patternt , " ".join([str(s) for s in rows_street]))

                       

 query_bulding =(
                  r"select distinct building "
                  r"from dbo.info"

                )    
rows_building = cursor.execute(query_building).fetchall()
rows_building = re.findall(patternt , " ".join([str(s) for s in rows_building]))

street_input =  st.selectbox("Select street",rows_street)
building_input =  st.selectbox("Select building",rows_building)