Creating Streamlit Form in Snowflake Database
Creating Streamlit Form in Snowflake Database
Step 1 : Create a Fruit Details table.
Step 2 : Create a Streamlit in Snowflake data entry form
Step 3 : Click on Create and add details and click on create.
Step 4 : Delete the selected code. And click run button.
Step 5 : Edit the Title and Instruction line. And run the code.
Step 6 : Add input fields.
Step 7 : Add variables to store input.
Remember that with our notebook we declared two variables. For the fruit name we named our variable "fn" and for our root depth code we named our variable "rdc."
Step 8 : Add one submit button.
Step 9 : Prepare to write the data in database.
if st.button('Submit'):
st.write('Fruit Name entered is ' + fn)
st.write('Root Depth Code chosen is ' + rdc)
sql_insert = 'insert into garden_plants.fruits.fruit_details select \''+fn+'\',\''+rdc+'\''
st.write(sql_insert)
Step 10 : Check the table.
Step 11 : Add more rows.
Send report.
--Set your worksheet drop list role to ACCOUNTADMIN
--Set your worksheet drop list database and schema to the location of your GRADER function
-- DO NOT EDIT ANYTHING BELOW THIS LINE. THE CODE MUST BE RUN EXACTLY AS IT IS WRITTEN
select GRADER(step, (actual = expected), actual, expected, description) as graded_results from (
SELECT 'DWW09' as step
,( select iff(count(*)=0, 0, count(*)/count(*))
from snowflake.account_usage.query_history
where query_text like 'execute streamlit "GARDEN_PLANTS"."FRUITS".%'
) as actual
, 1 as expected
,'SiS App Works' as description
);
Comments
Post a Comment