버전 1.x에서 2.0으로 프로젝트 정의 파일 마이그레이션

버전 1.x 프로젝트 정의 파일을 버전 2 형식으로 변환하려면 다음을 수행합니다.

  1. 버전 1.x snowflake.yml 파일이 포함된 프로젝트 디렉터리로 이동합니다.

  2. snow helpers v1-to-v2 명령을 입력합니다.

    • 버전 1.x 파일 변환이 성공하면 명령은 다음과 유사한 메시지를 표시합니다.

      cd <project-directory> snow helpers v1-to-v2 
      Copy
      Project definition migrated to version 2. 
    • 프로젝트 정의 파일이 이미 버전 2로 업데이트된 경우 이 명령을 실행하면 다음 메시지가 표시됩니다.

      cd <project-directory> snow helpers v1-to-v2 
      Copy
      Project definition is already at version 2. 
  • --[no]-migrate-local-overrides 옵션을 사용하지 않고 snowflake.local.yml 파일이 포함된 프로젝트 파일을 변환하려고 하면 다음과 유사한 오류가 발생됩니다.

  • 템플릿이 포함된 프로젝트 파일을 변환하려고 할 때 --accept-templates 옵션을 사용하지 않으면 다음과 유사한 오류가 발생됩니다.

    cd <project-directory> snow helpers v1-to-v2 
    Copy
    +- 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-v2 
    Copy
    WARNING 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 변환 예제

Native Apps 프로젝트 변환 예제

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 
Copy
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 
Copy

Native App 프로젝트 정의 V1에서 V2로 속성 변경

Native App 프로젝트 정의 V1에서 V2로 속성 변경

V1 속성

V2 속성

native_app.name

동등하지 않음. 필요한 경우 템플릿 변수를 사용하여 포팅합니다.

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 (위 참고 사항 참조)

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 (위 참고 사항 참조)

native_app.package.role

<package entity>.meta.role

native_app.package.scripts

<package entity>.meta.post_deploy (위 참고 사항 참조)

native_app.package.warehouse

<package entity>.meta.warehouse

마이그레이션 팁

  • 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 변환 예제

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" 
Copy
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 
Copy

Streamlit 프로젝트 정의 V1에서 V2로 속성 변경

Streamlit 프로젝트 정의 V1에서 V2로 속성 변경

V1 속성

V2 속성

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<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 마이그레이션 팁

없습니다.

Snowpark 프로젝트 변환

이 섹션에서는 Snowpark 프로젝트를 V1에서 V2로 변환하는 예제를 보여주며, 속성 이름의 변경 사항을 나열하고, 마이그레이션에 도움이 되는 몇 가지 팁을 제공합니다.

Snowpark 변환 예제

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 
Copy
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 
Copy

Snowpark 프로젝트 정의 V1에서 V2로 속성 변경

Snowpark 프로젝트 정의 V1에서 V2로 속성 변경

V1 속성

V2 속성

snowpark.project_name

프로젝트에서 마이그레이션된 각 함수 및/또는 프로시저의 경우 <함수 또는 프로시저 엔터티>.artifacts.dest. Snowpark 마이그레이션에 관한 위의 참고 사항을 참조하십시오. 각 함수 또는 프로시저는 destsnowpark.project_name 값으로, srcsnowpark.src 값으로 정의한 아티팩트를 선언해야 합니다. mixin을 사용하는 것이 좋습니다.

snowpark.stage_name

프로젝트에서 마이그레이션된 각 함수 및/또는 프로시저의 경우 <function or procedure entity>.stage.

snowpark.src

프로젝트에서 마이그레이션된 각 함수 및/또는 프로시저의 경우 <function or procedure entity>.artifacts.src. (위 snowpark.project_name 참조)

snowpark.functions (목록)

<function entities> (최상위 수준)

snowpark.procedures (목록)

<procedure entities> (최상위 수준)

Snowpark 함수 및 프로시저 정의 V1에서 V2로 속성 변경

V1 속성

V2 속성

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 (프로시저에만 해당)

Snowpark 마이그레이션 팁

  • Snowpark 프로젝트를 마이그레이션할 때 각 함수(snowpark.functions 배열에서) 또는 프로시저(snowpark.procedures 배열에서)는 최상위 수준 엔터티에 매핑됩니다.

  • 이제 각 함수와 프로시저에 대해 모든 최상위 수준 Snowpark 프로젝트 속성(예: src)이 정의됩니다. Snowflake는 중복을 줄이기 위해 mixin 을 선언하고 마이그레이션된 각 함수 및 프로시저 엔터티에 포함시킬 것을 권장합니다.