Application & Data Migration Blog Posts | Mobilize.Net

Can I use my .egg files in Snowpark?

Written by Mauricio Rojas | Oct 5, 2022 4:17:00 PM

I was looking at a project Mobilize.Net is moving from Spark to Snowpark, and this question popped up:

Is there a way to use my .egg files in Snowpark?

 

 

Technically, an .egg file is a zip file. And Snowpark allows you to package custom libraries as zip files, so I wanted to give it a try.

So I went to BlackDiamond Studio and I created a new project. It is very easy to start programming with Snowpark there. So I started a new project:

I selected to build my code from a template:

And selected the Python template:

This template allows you to get started right away. Once in there, I created a small set of code with this folder structure. 

 

The __init__.py is empty and used only for Python to recognize it as a package.

The main.py is simple:

And the setup.py is:

With that in place I used the context menu option (BlackDiamond: Export Python UDF) to generate a .sql deployment template:

I used that template as a based and modified it to:

And then created an small script to deploy it:

NOTE: I did have to modify the file extension from .egg to .zip.

With all that in place, I can call the UDF:

So as you can see, the answer is yes. You can use you .egg files in Snowpark.

That does not mean that I am recommending to use them, but it is perfectly valid to use this approach.