버전 1.x에서 2.0으로 프로젝트 정의 파일 마이그레이션¶
버전 1.x 프로젝트 정의 파일을 버전 2 형식으로 변환하려면 다음을 수행합니다.
버전 1.x
snowflake.yml
파일이 포함된 프로젝트 디렉터리로 이동합니다.snow helpers v1-to-v2
명령을 입력합니다.버전 1.x 파일 변환이 성공하면 명령은 다음과 유사한 메시지를 표시합니다.
cd <project-directory> snow helpers v1-to-v2
Project definition migrated to version 2.
프로젝트 정의 파일이 이미 버전 2로 업데이트된 경우 이 명령을 실행하면 다음 메시지가 표시됩니다.
cd <project-directory> snow helpers v1-to-v2
Project definition is already at version 2.
--[no]-migrate-local-overrides
옵션을 사용하지 않고snowflake.local.yml
파일이 포함된 프로젝트 파일을 변환하려고 하면 다음과 유사한 오류가 발생됩니다.
템플릿이 포함된 프로젝트 파일을 변환하려고 할 때
--accept-templates
옵션을 사용하지 않으면 다음과 유사한 오류가 발생됩니다.cd <project-directory> snow helpers v1-to-v2+- Error-------------------------------------------------------------------+ | snowflake.local.yml file detected, please specify | | --migrate-local-overrides to include or --no-migrate-local-overrides to | | exclude its values. | +--------------------------------------------------------------------------+템플릿이 포함된 프로젝트 정의 파일을 변환할 때
--accept-templates
옵션을 사용하면 명령이 파일을 변환하고 다음과 유사한 경고 메시지가 표시됩니다.cd <project-directory> snow helpers v1-to-v2WARNING snowflake.cli._plugins.workspace.commands:commands.py:60 Your V1 definition contains templates. We cannot guarantee the correctness of the migration. Project definition migrated to version 2
Native App 프로젝트 변환¶
이 섹션에서는 Snowflake Native App 프로젝트를 V1에서 V2로 변환하는 예제를 보여주고, 속성 이름의 변경 사항을 나열하며, 마이그레이션에 도움이 되는 몇 가지 팁을 제공합니다.
Snowflake Native App 변환 예제¶
V1 프로젝트 파일 |
V2 프로젝트 파일 |
---|---|
definition_version: 1
native_app:
name: myapp
source_stage: app_src.stage
artifacts:
- src: app/*
dest: ./
processors:
- native app setup
- name: templates
properties:
foo: bar
package:
role: pkg_role
distribution: external
application:
name: myapp_app
warehouse: app_wh
|
definition_version: 2
entities:
pkg:
type: application package
meta:
role: pkg_role
identifier: <% fn.concat_ids('myapp', '_pkg_', fn.sanitize_id(fn.get_username('unknown_user')) | lower) %>
manifest: app/manifest.yml
artifacts:
- src: app/*
dest: ./
processors:
- name: native app setup
- name: templates
properties:
foo: bar
stage: app_src.stage
app:
meta:
warehouse: app_wh
identifier: myapp_app
type: application
from:
target: pkg
|
Native App 프로젝트 정의 V1에서 V2로 속성 변경¶
V1 속성 |
V2 속성 |
---|---|
|
동등하지 않음. 필요한 경우 템플릿 변수를 사용하여 포팅합니다. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
마이그레이션 팁¶
Snowflake Native App 패키지 스크립트를 마이그레이션할 때
v1-to-v2
명령은 패키지 스크립트를package post-deploy
훅으로 변환하고 패키지 스크립트 파일의{{package_name}}
을 동일한 템플릿 식으로 대체합니다.기존 템플릿 식을 마이그레이션할 때
ctx.native_app
,:codenowrap:ctx.streamlit
및:codenowrap:ctx.snowpark
변수는 더 이상 허용되지 않습니다.v1-to-v2
명령을 특정 엔터티 이름을 대신 참조하는 동등한 템플릿 식과 함께 사용할 수 있습니다. 예를 들어, 패키지가snowflake.yml
파일에서 이름이pkg
인 엔터티로 마이그레이션된 경우ctx.native_app.package.name
ctx.entities.pkg.identifier
로 대체될 수 있습니다.
Streamlit 프로젝트 변환¶
이 섹션에서는 Streamlit 프로젝트를 V1에서 V2로 변환하는 예를 보여주고, 속성 이름의 변경 사항을 나열하며 마이그레이션에 도움이 되는 몇 가지 팁을 제공합니다.
Streamlit 변환 예제¶
V1 프로젝트 파일 |
V2 프로젝트 파일 |
---|---|
definition_version: 1
streamlit:
name: test_streamlit
stage: streamlit
query_warehouse: test_warehouse
main_file: "streamlit_app.py"
title: "My Fancy Streamlit"
|
definition_version: 2
entities:
test_streamlit:
identifier:
name: test_streamlit
type: streamlit
title: My Fancy Streamlit
query_warehouse: test_warehouse
main_file: streamlit_app.py
pages_dir: None
stage: streamlit
artifacts:
- streamlit_app.py
|
Streamlit 프로젝트 정의 V1에서 V2로 속성 변경¶
V1 속성 |
V2 속성 |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Streamlit 마이그레이션 팁¶
없습니다.
Snowpark 프로젝트 변환¶
이 섹션에서는 Snowpark 프로젝트를 V1에서 V2로 변환하는 예제를 보여주며, 속성 이름의 변경 사항을 나열하고, 마이그레이션에 도움이 되는 몇 가지 팁을 제공합니다.
Snowpark 변환 예제¶
V1 프로젝트 파일 |
V2 프로젝트 파일 |
---|---|
definition_version: 1
snowpark:
project_name: "my_snowpark_project"
stage_name: "dev_deployment"
src: "app/"
functions:
- name: func1
handler: "app.func1_handler"
signature:
- name: "a"
type: "string"
default: "default value"
- name: "b"
type: "variant"
returns: string
runtime: 3.10
procedures:
- name: procedureName
handler: "hello"
signature:
- name: "name"
type: "string"
returns: string
|
definition_version: 2
entities:
procedureName:
imports: []
external_access_integrations: []
secrets: {}
meta:
use_mixins:
- snowpark_shared
identifier:
name: procedureName
handler: hello
returns: string
signature:
- name: name
type: string
stage: dev_deployment
artifacts:
- src: app
dest: my_snowpark_project
type: procedure
execute_as_caller: false
func1:
imports: []
external_access_integrations: []
secrets: {}
meta:
use_mixins:
- snowpark_shared
identifier:
name: func1
handler: app.func1_handler
returns: string
signature:
- name: a
type: string
default: default value
- name: b
type: variant
runtime: '3.10'
stage: dev_deployment
artifacts:
- src: app
dest: my_snowpark_project
type: function
mixins:
snowpark_shared:
stage: dev_deployment
artifacts:
- src: app/
dest: my_snowpark_project
|
Snowpark 프로젝트 정의 V1에서 V2로 속성 변경¶
V1 속성 |
V2 속성 |
---|---|
|
프로젝트에서 마이그레이션된 각 함수 및/또는 프로시저의 경우 |
|
프로젝트에서 마이그레이션된 각 함수 및/또는 프로시저의 경우 |
|
프로젝트에서 마이그레이션된 각 함수 및/또는 프로시저의 경우 |
|
|
|
|
V1 속성 |
V2 속성 |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Snowpark 마이그레이션 팁¶
Snowpark 프로젝트를 마이그레이션할 때 각 함수(
snowpark.functions
배열에서) 또는 프로시저(snowpark.procedures
배열에서)는 최상위 수준 엔터티에 매핑됩니다.이제 각 함수와 프로시저에 대해 모든 최상위 수준 Snowpark 프로젝트 속성(예:
src
)이 정의됩니다. Snowflake는 중복을 줄이기 위해mixin
을 선언하고 마이그레이션된 각 함수 및 프로시저 엔터티에 포함시킬 것을 권장합니다.