From the course: Snowpark for Data Engineers

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Deploying a stored procedure

Deploying a stored procedure - Snowflake Tutorial

From the course: Snowpark for Data Engineers

Deploying a stored procedure

- [Instructor] In this video, I'll show you a slightly different way to create a stored procedure. We'll do so by deploying a simple function. I've defined a function here in this Python worksheet. You see all of these underlines here because the Python worksheet expects a Snowpark handler and I have a function named analyze_nutrition_data, and this Python worksheet expects that the name of the handler is main. Let's see what this function does before I show you how you can deploy this as a stored procedure. Analyze_nutrition_data takes in a session as an input argument and then queries the tea_nutrition table and gets the results as a DataFrame, df. This is on line five. We then perform some simple DataFrame transformation. We group by the name of the tea and compute the average min and max values for calories, sugars, protein, and caffeine for all of the tea types, and it's this grouped aggregated values that we return in the result on line 23. Now, I'm going to deploy this as a…

Contents