Did you know that you can use python scripts in Snowflake? In this challenge you will have to upload a script to a stage and then use it in a stored procedure.
Click here to copy the code
CREATE OR REPLACE PROCEDURE frosty_challenge()
returns string
language python
packages=('snowflake-snowpark-python')
imports=('your import goes here')
handler = 'func'
RUNTIME_VERSION=3.8
as
$$
your import goes here
def func(session):
your code goes here
return r
$$
;
CALL frosty_challenge();
Create a python file with the following content and upload it to a stage in Snowflake:
def success():
return 'Congratulations!'
Upload the file to a stage. Then specify the path to your stage in the ‘Imports = ()’ part of your procedure. Then import the function ‘success ‘from the file and use it. You will have finished the challenge when your stored procedure returns the string ‘Congratulations!’.
Remember if you want to participate:
- Sign up as a member of Frosty Friday. You can do this by clicking on the sidebar, and then going to ‘REGISTER‘ (note joining our mailing list does not give you a Frosty Friday account)
- Post your code to GitHub and make it publicly available (Check out our guide if you don’t know how to here)
- Post the URL in the comments of the challenge.