0
0
Snowflakecloud~5 mins

Stored procedures in Python in Snowflake - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a stored procedure in Snowflake using Python?
A stored procedure is a set of SQL and Python commands saved in the database that can be run repeatedly to perform tasks like data processing or automation.
Click to reveal answer
beginner
How do you define a Python stored procedure in Snowflake?
You use the CREATE PROCEDURE statement with LANGUAGE PYTHON, then write your Python code inside a handler function that Snowflake runs when called.
Click to reveal answer
intermediate
What is the role of the 'handler' function in a Snowflake Python stored procedure?
The handler function contains the Python code that executes when the stored procedure is called. It receives context and parameters and returns results.
Click to reveal answer
intermediate
Why use stored procedures in Python on Snowflake instead of running scripts externally?
Stored procedures run close to the data inside Snowflake, reducing data transfer, improving speed, and allowing automation within the database environment.
Click to reveal answer
advanced
What permissions are needed to create and run Python stored procedures in Snowflake?
You need the CREATE PROCEDURE privilege on the schema and USAGE privilege on the database and schema. Also, EXECUTE privilege to run the procedure.
Click to reveal answer
Which keyword specifies that a stored procedure uses Python in Snowflake?
ALANGUAGE SHELL
BLANGUAGE SQL
CLANGUAGE PYTHON
DLANGUAGE JAVASCRIPT
What is the main function name Snowflake expects in a Python stored procedure?
Ahandler
Bmain
Crun
Dexecute
Which privilege is NOT required to create a Python stored procedure in Snowflake?
AUSAGE on schema
BDROP DATABASE
CEXECUTE on procedure
DCREATE PROCEDURE
Why is running Python code inside Snowflake stored procedures efficient?
ABecause it uses external servers
BBecause it uses JavaScript internally
CBecause it requires no permissions
DBecause it runs close to the data inside Snowflake
How do you call a Python stored procedure in Snowflake after creation?
ACALL procedure_name()
BEXECUTE procedure_name()
CRUN procedure_name()
DSTART procedure_name()
Explain how to create and use a Python stored procedure in Snowflake.
Think about the syntax, function name, and how you run it.
You got /4 concepts.
    Describe the benefits of using Python stored procedures inside Snowflake compared to running Python scripts externally.
    Consider where the code runs and how it affects performance.
    You got /4 concepts.