Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jsikorski committed Aug 27, 2024
1 parent e15dbdf commit cfb1e68
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/snowflake/cli/_plugins/snowpark/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ def migrate_v1_snowpark_to_v2(pd: ProjectDefinition):

data["entities"][entity_name] = v2_entity

if pd.env:
data["env"] = {k: v for k, v in pd.env.items()}

return ProjectDefinitionV2(**data)


Expand Down
1 change: 1 addition & 0 deletions src/snowflake/cli/_plugins/workspace/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import typer
import yaml
from click import ClickException
from snowflake.cli._plugins.nativeapp.artifacts import BundleMap
from snowflake.cli._plugins.snowpark.commands import migrate_v1_snowpark_to_v2
from snowflake.cli._plugins.streamlit.commands import migrate_v1_streamlit_to_v2
Expand Down
2 changes: 2 additions & 0 deletions tests/test_data/projects/snowpark_templated_v1/snowflake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ snowpark:
handler: "procedures.test_procedure"
signature: ""
returns: string
env:
project_source: "app/"
2 changes: 2 additions & 0 deletions tests/test_data/projects/streamlit_templated_v1/snowflake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ streamlit:
title: <% ctx.env.streamlit_title %>
additional_source_files:
- common/hello.py
env:
streamlit_title: "My Fancy Streamlit"
33 changes: 27 additions & 6 deletions tests/workspace/__snapshots__/test_manager.ambr
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# serializer version: 1
# name: test_if_template_is_not_rendered_during_migration_with_option_checked[snowpark_templated_v1]
'''
defaults:
project_name: <! project_name | to_snowflake_identifier !>
stage: <! stage | to_snowflake_identifier !>
definition_version: '2'
entities:
hello_function:
artifacts:
- <% ctx.env.project_source %>
- dest: <! project_name | to_snowflake_identifier !>
src: <% ctx.env.project_source %>
external_access_integrations: []
handler: functions.hello_function
identifier:
name: hello_function
imports: []
meta:
use_mixins:
- snowpark_shared
returns: string
secrets: {}
signature:
Expand All @@ -23,13 +24,17 @@
type: function
hello_procedure:
artifacts:
- <% ctx.env.project_source %>
- dest: <! project_name | to_snowflake_identifier !>
src: <% ctx.env.project_source %>
execute_as_caller: false
external_access_integrations: []
handler: procedures.hello_procedure
identifier:
name: hello_procedure
imports: []
meta:
use_mixins:
- snowpark_shared
returns: string
secrets: {}
signature:
Expand All @@ -39,18 +44,30 @@
type: procedure
test_procedure:
artifacts:
- <% ctx.env.project_source %>
- dest: <! project_name | to_snowflake_identifier !>
src: <% ctx.env.project_source %>
execute_as_caller: false
external_access_integrations: []
handler: procedures.test_procedure
identifier:
name: test_procedure
imports: []
meta:
use_mixins:
- snowpark_shared
returns: string
secrets: {}
signature: ''
stage: <! stage | to_snowflake_identifier !>
type: procedure
env:
project_source: app/
mixins:
snowpark_shared:
artifacts:
- dest: <! project_name | to_snowflake_identifier !>
src: <% ctx.env.project_source %>
stage: <! stage | to_snowflake_identifier !>

'''
# ---
Expand Down Expand Up @@ -79,6 +96,8 @@
handler: "procedures.test_procedure"
signature: ""
returns: string
env:
project_source: "app/"

'''
# ---
Expand Down Expand Up @@ -116,6 +135,8 @@
title: <% ctx.env.streamlit_title %>
additional_source_files:
- common/hello.py
env:
streamlit_title: "My Fancy Streamlit"

'''
# ---
Expand Down

0 comments on commit cfb1e68

Please sign in to comment.