I have written some python stored procedures in snowflake. Can I maintain this stored procedures within visual studio code IDE. I need to do the following.
- See code changes
- Modify stored procedure from vs code
- Ability to deploy stored procedures from vs code to snowflake.
Any help is appreciated!
As of now I am unable to find a solution.
2
Answers
Finally I found an approach to continue development in vs code and deploy the python script as stored procedure in Snowflake.
Need to use the cproc() provided in the snowflake snowpark package
from snowflake.snowpark.functions import sproc
Then we can use this function to register the python function as snowflake stored procedure like this.
def add_two_number(sp_session : Session, input_1 : int , input_2 : int) -> str:
return input_1 + input_2
sess.sproc.register(func=add_two_number, is_permanent=True, stage_location="@procedure",name="add_two_number", replace=True)
Reference: https://medium.com/@thedataengineeringblogpost/sproc-a-powerful-tool-for-creating-python-stored-procedures-in-snowflake-a40d94e31da5
You can download the GitLab/GitHub extension depending upon what you want to use for your version control and also download the Snowflake extension to execute your queries /procedure i Snowflake from Visual Studio. to store the file.
The screen shot of the UI with Git and Snowflake extension in Visual studio as below.