Week 95 - Data Loading & Staging

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.

CREATE OR REPLACE PROCEDURE frosty_challenge()returns stringlanguage pythonpackages=('snowflake-snowpark-python')imports=('your import goes here')handler = 'func'RUNTIME_VERSION=3.8as$$your import goes heredef func(session):your code goes herereturn 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:

  1. 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)
  2. Post your code to GitHub and make it publicly available (Check out our guide if you don’t know how to here)
  3. Post the URL in the comments of the challenge.
Previous
Previous

Week 96 - Administration

Next
Next

Week 94 – Snowpark & Python