I have been using Snowflake CLI to orchestrate and deploy stored procedures to Snowflake Data Warehouse.
I have my app setup properly (as described in the documentation: Snowflake CLI project definition) in my local repo:
Everything works as expected. To deploy my app, I just use the snow snowpark deploy --replace
command.
This is an example of one of the stored procedure I have deployed (which works perfectly):
However, I have come across the following information about Python runtime_version
support:
I tried to search in the documentation available a way of changing the default python's runtime version for the deployed stored procedures, but I was not able to find anything. I tried to execute snow snowpark deploy --env RUNTIME_VERSION='3.9' --replace
command instead, but it didn't work.
Is there a way we can change the runtime version?
See:
If you're using the latest version of the cli (v3.0.1 is what I tested with) then the default runtime version is 3.10.
In any case, you can change that by providing the 'runtime' property. For example, here's my hello procedure definition in my snowflake.yml file:
hello_procedure:
type: procedure
identifier:
name: hello_procedure
handler: procedures.hello_procedure
runtime: 3.9
signature:
- name: name
type: string
returns: string
meta:
use_mixins:
- snowpark_shared
The result is the following create stored procedure SQL statement:
create or replace procedure IDENTIFIER('SNOWPARK_EXAMPLE.TEST_SCHEMA.hello_procedure')(name string)
copy grants
returns string
language python
runtime_version=3.9
imports=('@SNOWPARK_EXAMPLE.TEST_SCHEMA.dev_deployment/my_snowpark_project/app.zip')
handler='procedures.hello_procedure'
packages=('snowflake-snowpark-python')
runtime_version
would have pointed to 3.10 if I haven't provided that in my yml configuration file, because that's the default in the snowflake-cli version 3.0.1. I had to build that from source though using the instructions here.