snowflake-cli-labs 2.8.0rc0__py3-none-any.whl → 2.8.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- snowflake/cli/__about__.py +1 -1
- snowflake/cli/api/project/errors.py +16 -1
- snowflake/cli/plugins/nativeapp/manager.py +17 -13
- {snowflake_cli_labs-2.8.0rc0.dist-info → snowflake_cli_labs-2.8.0rc1.dist-info}/METADATA +1 -1
- {snowflake_cli_labs-2.8.0rc0.dist-info → snowflake_cli_labs-2.8.0rc1.dist-info}/RECORD +8 -8
- {snowflake_cli_labs-2.8.0rc0.dist-info → snowflake_cli_labs-2.8.0rc1.dist-info}/WHEEL +0 -0
- {snowflake_cli_labs-2.8.0rc0.dist-info → snowflake_cli_labs-2.8.0rc1.dist-info}/entry_points.txt +0 -0
- {snowflake_cli_labs-2.8.0rc0.dist-info → snowflake_cli_labs-2.8.0rc1.dist-info}/licenses/LICENSE +0 -0
snowflake/cli/__about__.py
CHANGED
|
@@ -29,10 +29,25 @@ class SchemaValidationError(ClickException):
|
|
|
29
29
|
def __init__(self, error: ValidationError):
|
|
30
30
|
errors = error.errors()
|
|
31
31
|
message = f"During evaluation of {error.title} in project definition following errors were encountered:\n"
|
|
32
|
+
|
|
33
|
+
def calculate_location(e):
|
|
34
|
+
if e["loc"] is None:
|
|
35
|
+
return None
|
|
36
|
+
|
|
37
|
+
# show numbers as list indexes and strings as dictionary keys. Example: key1[0].key2
|
|
38
|
+
result = "".join(
|
|
39
|
+
f"[{item}]" if isinstance(item, int) else f".{item}"
|
|
40
|
+
for item in e["loc"]
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
# remove leading dot from the string if any:
|
|
44
|
+
return result[1:] if result.startswith(".") else result
|
|
45
|
+
|
|
32
46
|
message += "\n".join(
|
|
33
47
|
[
|
|
34
48
|
self.message_templates.get(e["type"], self.generic_message).format(
|
|
35
|
-
**e,
|
|
49
|
+
**e,
|
|
50
|
+
location=calculate_location(e),
|
|
36
51
|
)
|
|
37
52
|
for e in errors
|
|
38
53
|
]
|
|
@@ -45,6 +45,7 @@ from snowflake.cli.api.project.util import (
|
|
|
45
45
|
from snowflake.cli.api.rendering.sql_templates import (
|
|
46
46
|
get_sql_cli_jinja_env,
|
|
47
47
|
)
|
|
48
|
+
from snowflake.cli.api.secure_path import UNLIMITED, SecurePath
|
|
48
49
|
from snowflake.cli.api.sql_execution import SqlExecutionMixin
|
|
49
50
|
from snowflake.cli.plugins.connection.util import make_snowsight_url
|
|
50
51
|
from snowflake.cli.plugins.nativeapp.artifacts import (
|
|
@@ -577,7 +578,10 @@ class NativeAppManager(SqlExecutionMixin):
|
|
|
577
578
|
)
|
|
578
579
|
|
|
579
580
|
def _expand_script_templates(
|
|
580
|
-
self,
|
|
581
|
+
self,
|
|
582
|
+
env: jinja2.Environment,
|
|
583
|
+
jinja_context: dict[str, Any],
|
|
584
|
+
scripts: List[str],
|
|
581
585
|
) -> List[str]:
|
|
582
586
|
"""
|
|
583
587
|
Input:
|
|
@@ -589,20 +593,22 @@ class NativeAppManager(SqlExecutionMixin):
|
|
|
589
593
|
Size of the return list is the same as the size of the input scripts list.
|
|
590
594
|
"""
|
|
591
595
|
scripts_contents = []
|
|
592
|
-
for
|
|
596
|
+
for script in scripts:
|
|
597
|
+
full_path = SecurePath(self.project_root) / script
|
|
593
598
|
try:
|
|
594
|
-
|
|
599
|
+
template_content = full_path.read_text(file_size_limit_mb=UNLIMITED)
|
|
600
|
+
template = env.from_string(template_content)
|
|
595
601
|
result = template.render(**jinja_context)
|
|
596
602
|
scripts_contents.append(result)
|
|
597
603
|
|
|
598
|
-
except
|
|
599
|
-
raise MissingScriptError(
|
|
604
|
+
except FileNotFoundError as e:
|
|
605
|
+
raise MissingScriptError(script) from e
|
|
600
606
|
|
|
601
607
|
except jinja2.TemplateSyntaxError as e:
|
|
602
|
-
raise InvalidScriptError(
|
|
608
|
+
raise InvalidScriptError(script, e, e.lineno) from e
|
|
603
609
|
|
|
604
610
|
except jinja2.UndefinedError as e:
|
|
605
|
-
raise InvalidScriptError(
|
|
611
|
+
raise InvalidScriptError(script, e) from e
|
|
606
612
|
|
|
607
613
|
return scripts_contents
|
|
608
614
|
|
|
@@ -618,7 +624,7 @@ class NativeAppManager(SqlExecutionMixin):
|
|
|
618
624
|
)
|
|
619
625
|
|
|
620
626
|
env = jinja2.Environment(
|
|
621
|
-
loader=jinja2.
|
|
627
|
+
loader=jinja2.BaseLoader(),
|
|
622
628
|
keep_trailing_newline=True,
|
|
623
629
|
undefined=jinja2.StrictUndefined,
|
|
624
630
|
)
|
|
@@ -668,19 +674,17 @@ class NativeAppManager(SqlExecutionMixin):
|
|
|
668
674
|
if not post_deploy_hooks:
|
|
669
675
|
return
|
|
670
676
|
|
|
671
|
-
with cc.phase(f"Executing {deployed_object_type}
|
|
677
|
+
with cc.phase(f"Executing {deployed_object_type} post_deploy actions"):
|
|
672
678
|
sql_scripts_paths = []
|
|
673
679
|
for hook in post_deploy_hooks:
|
|
674
680
|
if hook.sql_script:
|
|
675
681
|
sql_scripts_paths.append(hook.sql_script)
|
|
676
682
|
else:
|
|
677
683
|
raise ValueError(
|
|
678
|
-
f"Unsupported {deployed_object_type}
|
|
684
|
+
f"Unsupported {deployed_object_type} post_deploy hook type: {hook}"
|
|
679
685
|
)
|
|
680
686
|
|
|
681
|
-
env = get_sql_cli_jinja_env(
|
|
682
|
-
loader=jinja2.loaders.FileSystemLoader(self.project_root)
|
|
683
|
-
)
|
|
687
|
+
env = get_sql_cli_jinja_env()
|
|
684
688
|
scripts_content_list = self._expand_script_templates(
|
|
685
689
|
env, cli_context.template_context, sql_scripts_paths
|
|
686
690
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
snowflake/cli/__about__.py,sha256
|
|
1
|
+
snowflake/cli/__about__.py,sha256=--zpRaqLpjNYGKlTH_ufSpk37KBoL5EjRpdoCanEWF4,636
|
|
2
2
|
snowflake/cli/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
3
3
|
snowflake/cli/api/__init__.py,sha256=kD6lYv5et7QJvW7vzvLN9p2ibfD7pjh9KRWsp2QoYqo,1330
|
|
4
4
|
snowflake/cli/api/cli_global_context.py,sha256=gAs7snaqRi5ESaxU8HcC_QBR2q9y1PMdhi7kQCGkICs,11714
|
|
@@ -36,7 +36,7 @@ snowflake/cli/api/plugins/command/plugin_hook_specs.py,sha256=AHJGk6j3NRzalIe4ll
|
|
|
36
36
|
snowflake/cli/api/project/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
37
37
|
snowflake/cli/api/project/definition.py,sha256=12R3Z59bp0y0E1eQC2E1VFxRx3HwsFzk4p9nlkW0csk,2987
|
|
38
38
|
snowflake/cli/api/project/definition_manager.py,sha256=h1ympKIZ9TB5a-WgEro4gm8BjqpHxAeCwXVppV26x0Y,4645
|
|
39
|
-
snowflake/cli/api/project/errors.py,sha256=
|
|
39
|
+
snowflake/cli/api/project/errors.py,sha256=9TGN2ezqSCHmSGy1U7AByaJm5Xf47zN-7N3i6R6fyBg,2136
|
|
40
40
|
snowflake/cli/api/project/project_verification.py,sha256=l3K6SMDJxpys9xhnwxBhd6BDyQVqqUItsf4FKAp8NtA,951
|
|
41
41
|
snowflake/cli/api/project/util.py,sha256=wung3PYl3_32RO-R2Qu7SGFnYWpIxqE6bltJFyoWnfc,8678
|
|
42
42
|
snowflake/cli/api/project/schemas/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
@@ -133,7 +133,7 @@ snowflake/cli/plugins/nativeapp/constants.py,sha256=j25fS9dS54GPPp41njUOZTDykhYq
|
|
|
133
133
|
snowflake/cli/plugins/nativeapp/exceptions.py,sha256=Wh-qJlAG9UMdWB0lqAVafbBdA_hj_m7UnI4efLjOgUA,4360
|
|
134
134
|
snowflake/cli/plugins/nativeapp/feature_flags.py,sha256=Y1peJF8ju_lybKjklOvXYsGQMN8VhFoLnoq-Z7oqO-E,829
|
|
135
135
|
snowflake/cli/plugins/nativeapp/init.py,sha256=BX0rDIJem5bJn0-0s5Ha3BSJIX82ZWJLsDiJvuQSsAA,12124
|
|
136
|
-
snowflake/cli/plugins/nativeapp/manager.py,sha256=
|
|
136
|
+
snowflake/cli/plugins/nativeapp/manager.py,sha256=Xel0eAhs65FQBGWT-3eKI5Zi33qioXoAWKX3tu34j9s,31023
|
|
137
137
|
snowflake/cli/plugins/nativeapp/plugin_spec.py,sha256=CWpkkQlCjY7kO-JLFdAx6UtUo4FZ2soJXcxjUAnUflM,997
|
|
138
138
|
snowflake/cli/plugins/nativeapp/policy.py,sha256=yND6QTJUtbuREdT9I2fzFI4-XFd7zbNgWKlvoFICwko,1605
|
|
139
139
|
snowflake/cli/plugins/nativeapp/project_model.py,sha256=uLVLEbefN_vV0TbsYJWTOQD-YO2_-scJzxS69aE1RHo,6774
|
|
@@ -233,8 +233,8 @@ snowflake/cli/templates/default_streamlit/snowflake.yml,sha256=yWFU-vqJ7Z17K3loU
|
|
|
233
233
|
snowflake/cli/templates/default_streamlit/streamlit_app.py,sha256=hfYtJl4Rtm0n3J2gNeDwMT-leeGL5R-qJKwyJ0kUxAI,109
|
|
234
234
|
snowflake/cli/templates/default_streamlit/common/hello.py,sha256=3Zt2LthAYDs6UGqOvRNCzYH-HISLHxdx_uAVhcCOtJM,37
|
|
235
235
|
snowflake/cli/templates/default_streamlit/pages/my_page.py,sha256=f__P9j5XCo8J1c6du25wSvknIKvhTFWrXF_298YiQbw,49
|
|
236
|
-
snowflake_cli_labs-2.8.
|
|
237
|
-
snowflake_cli_labs-2.8.
|
|
238
|
-
snowflake_cli_labs-2.8.
|
|
239
|
-
snowflake_cli_labs-2.8.
|
|
240
|
-
snowflake_cli_labs-2.8.
|
|
236
|
+
snowflake_cli_labs-2.8.0rc1.dist-info/METADATA,sha256=TuH8YQDJ4B7S4_Gmvfh0rCrGrcCPHWtizbEwCgJ0Ooc,17804
|
|
237
|
+
snowflake_cli_labs-2.8.0rc1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
238
|
+
snowflake_cli_labs-2.8.0rc1.dist-info/entry_points.txt,sha256=_qdnT44fYFbH78kb6Em5jr2_26amIg3UIAvSdmqT6TY,57
|
|
239
|
+
snowflake_cli_labs-2.8.0rc1.dist-info/licenses/LICENSE,sha256=mJMA3Uz2AbjU_kVggo1CAx01XhBsI7BSi2H7ggUg_-c,11344
|
|
240
|
+
snowflake_cli_labs-2.8.0rc1.dist-info/RECORD,,
|
|
File without changes
|
{snowflake_cli_labs-2.8.0rc0.dist-info → snowflake_cli_labs-2.8.0rc1.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{snowflake_cli_labs-2.8.0rc0.dist-info → snowflake_cli_labs-2.8.0rc1.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|