#import python
import streamlit as st
from snowflake.snowpark.functions import col
Write directly to the app
st.title(“ Customize your smoothies!
”)
st.write(
“”“Choose the fruit you want in your custom smoothie.
“””
)
#option = st.selectbox(‘Select any One:’, (“Banana”, “Apple”))
#st.write(‘Your selected option:’, option)
name_on_order = st.text_input(‘Name on Smoothie:’)
st.write(‘The name of your smoothie will be:’, name_on_order)
cnx = st.connection(“snowflake”)
session = cnx.session()
my_dataframe = session.table(“smoothies.public.fruit_options”).select(col(‘FRUIT_NAME’))
#st.dataframe(data = my_dataframe, use_container_width=True)
ingredients_list = st.multiselect(‘Select 5 Ingridients:’, my_dataframe,
max_selections =5)
if ingredients_list:
#st.write(ingridients_list)
#st.text(ingridients_list)
ingredients_string = ''
for frutis_choosen in ingredients_list:
ingredients_string += frutis_choosen+' '
#st.write(ingredients_string)
my_insert_stmt = """ insert into smoothies.public.orders(ingredients,name_on_order)
values('"""+ingredients_string+"""','"""+name_on_order+"""')"""
#st.write(my_insert_stmt)
#st.stop()
time_to_insert = st.button('Submit Order')
if time_to_insert:
session.sql(my_insert_stmt).collect()
st.success('Your Smoothie is ordered, '+name_on_order+' !', icon="✅")
#requirements.txt
snowflake-connector-python
snowflake-snowpark-python
streamlit==1.31.1
Logs:
────────────────────── Traceback (most recent call last) ───────────────────────
/home/adminuser/venv/lib/python3.8/site-packages/streamlit/runtime/scriptrun
ner/script_runner.py:589 in _run_script
/mount/src/melanies_smoothies/streamlit_app.py:3 in
1 #import python
2 import streamlit as st
❱ 3 from snowflake.snowpark.functions import col
4
5 # Write directly to the app
6 st.title(“ Customize your smoothies!
”)
ModuleNotFoundError: No module named ‘snowflake’