Migrating project definition files from version 1.x to 2.0¶
To convert a version 1.x project definition file to the version 2 format, do the following:
- Go to your project directory that contains the version 1.x
snowflake.ymlfile. - Enter the
snow helpers v1-to-v2command.-
If the version 1.x file conversion succeeds, the command displays a message similar to the following:
-
If your project definition file is already updated to version 2, the command displays the following message:
-
- If you try to convert a project file that contains a snowflake.local.yml file, without using the
--[no]-migrate-local-overridesoption, the command generates an error similar to the following:
If you try to convert a project file that contains templates, without using the
--accept-templatesoption, the command generates an error similar to the following:If you convert a project definition file that contains templates, and use the
--accept-templatesoption, the command converts the file and displays a warning message similar to the following:
Convert Native App projects¶
This section shows an example from a V1 to V2 conversion of a Snowflake Native App project, lists the changes in property names, and offers some tips to help with migration.
Snowflake Native App conversion example¶
Native Apps project conversion example
| V1 project file | V2 project file |
|---|---|
Native App project definition V1 to V2 property changes¶
Native App project definition V1 to V2 property changes
| V1 property | V2 property |
|---|---|
native_app.name | No equivalent. Use a template variable to port, if required. |
native_app.deploy_root | <package entity>.deploy_root |
native_app.generated_root | <package entity>.generated_root |
native_app.bundle_root | <package entity>.bundle_root |
native_app.source_stage | <package entity>.source_stage |
native_app.scratch_stage | <package entity>.scratch_stage |
native_app.artifacts | <package entity>.artifacts |
native_app.application.debug | <application entity>.debug |
native_app.application.name | <application entity>.identifier |
native_app.application.post_deploy | <application entity>.meta.post_deploy (see above notes) |
native_app.application.role | <application entity>.meta.role |
native_app.application.warehouse | <application entity>.meta.warehouse |
native_app.package.distribution | <package entity>.distribution |
native_app.package.name | <package entity>.identifier |
native_app.package.post_deploy | <package entity>.meta.post_deploy (see above notes) |
native_app.package.role | <package entity>.meta.role |
native_app.package.scripts | <package entity>.meta.post_deploy (see above notes) |
native_app.package.warehouse | <package entity>.meta.warehouse |
Migration tips¶
- When migrating Snowflake Native App package scripts, the
v1-to-v2command converts them topackage post-deployhooks and replaces{{package_name}}in the package script file with the equivalent template expression. - When migrating existing template expressions,
ctx.native_app,ctx.streamlit, andctx.snowparkvariables are no longer accepted. Thev1-to-v2command with equivalent template expressions that reference the specific entity name instead. For example,ctx.native_app.package.namecould be replaced withctx.entities.pkg.identifierif the package was migrated to an entity namedpkgin thesnowflake.ymlfile.
Convert Streamlit projects¶
This section shows an example from a V1 to V2 conversion of a Streamlit project, lists the changes in property names, and offers some tips to help with migration.
Streamlit conversion example¶
Streamlit project conversion example
| V1 project file | V2 project file |
|---|---|
Streamlit project definition V1 to V2 property changes¶
Streamlit project definition V1 to V2 property changes
| V1 property | V2 property |
|---|---|
streamlit.name | <streamlit entity>.identifier.name |
streamlit.schema | <streamlit entity>.identifier.schema |
streamlit.database | <streamlit entity>.identifier.database |
streamlit.comment | <streamlit entity>.comment |
streamlit.title | <streamlit entity>.title |
streamlit.query_warehouse | <streamlit entity>.query_warehouse |
streamlit.main_file | <streamlit entity>.main_file and <streamlit entity>.artifacts |
streamlit.stage | <streamlit entity>.stage |
streamlit.env_file | <streamlit entity>.artifacts |
streamlit.pages_dir | <streamlit entity>.pages_dir and <streamlit entity>.artifacts |
streamlit.additional_source_files | <streamlit entity>.artifacts |
Streamlit migration tips¶
None.
Convert Snowpark projects¶
This section shows an example from a V1 to V2 conversion of a Snowpark project, lists the changes in property names, and offers some tips to help with migration.
Snowpark conversion example¶
Snowpark project conversion example
| V1 project file | V2 project file |
|---|---|
Snowpark project definition V1 to V2 property changes¶
Snowpark project definition V1 to V2 property changes
| V1 property | V2 property |
|---|---|
snowpark.project_name | <function or procedure entity>.artifacts.dest for each function and/or procedure migrated from the project. See above notes regarding Snowpark migration. Each function or procedure should declare an artifact with dest defined as the snowpark.project_name value, and src defined as the snowpark.src value. Use of a mixin is recommended. |
snowpark.stage_name | <function or procedure entity>.stage for each function and/or procedure migrated from the project. |
snowpark.src | <function or procedure entity>.artifacts.src for each function and/or procedure migrated from the project. (see snowpark.project_name above) |
snowpark.functions (list) | <function entities> (top-level) |
snowpark.procedures (list) | <procedure entities> (top-level) |
Snowpark function and procedure definition V1 to V2 property changes
| V1 property | V2 property |
|---|---|
name | identifier.name |
schema | identifier.schema |
database | identifier.database |
handler | handler |
returns | returns |
signature | signature |
runtime | runtime |
external_access_integrations | external_access_integrations |
secrets | secrets |
imports | imports |
execute_as_caller | execute_as_caller (only for procedures) |
Snowpark migration tips¶
- When migrating Snowpark projects, each function (from the
snowpark.functionsarray) or procedure (from thesnowpark.proceduresarray) maps to a top-level entity. - All top-level Snowpark project properties (e.g.
src) are now defined for each function and procedure. To reduce duplication, Snowflake recommends that you declare amixinand include it in each of the migrated function and procedure entities.