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.
@@ -14,4 +14,4 @@
14
14
 
15
15
  from __future__ import annotations
16
16
 
17
- VERSION = "2.8.0rc0"
17
+ VERSION = "2.8.0rc1"
@@ -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, location=".".join(e["loc"]) if e["loc"] is not None else None
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, env: jinja2.Environment, jinja_context: dict[str, Any], scripts: List[str]
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 relpath in scripts:
596
+ for script in scripts:
597
+ full_path = SecurePath(self.project_root) / script
593
598
  try:
594
- template = env.get_template(relpath)
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 jinja2.TemplateNotFound as e:
599
- raise MissingScriptError(e.name) from e
604
+ except FileNotFoundError as e:
605
+ raise MissingScriptError(script) from e
600
606
 
601
607
  except jinja2.TemplateSyntaxError as e:
602
- raise InvalidScriptError(e.name, e, e.lineno) from e
608
+ raise InvalidScriptError(script, e, e.lineno) from e
603
609
 
604
610
  except jinja2.UndefinedError as e:
605
- raise InvalidScriptError(relpath, e) from e
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.loaders.FileSystemLoader(self.project_root),
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} post-deploy actions"):
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} post-deploy hook type: {hook}"
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,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: snowflake-cli-labs
3
- Version: 2.8.0rc0
3
+ Version: 2.8.0rc1
4
4
  Summary: Snowflake CLI
5
5
  Project-URL: Source code, https://github.com/snowflakedb/snowflake-cli
6
6
  Project-URL: Bug Tracker, https://github.com/snowflakedb/snowflake-cli/issues
@@ -1,4 +1,4 @@
1
- snowflake/cli/__about__.py,sha256=DXQdpxAQ2bEz1VwFbGeObG4Lm7jRX_ojFsaj5ClOhQg,636
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=LJY_XkL6B6agD4jAxXxFbEe80j6Pak5SxSP67Ls4Fkc,1674
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=z89L8Srwe2GQfosOEQumqYASWHghxjDR7Qtq8cjO_tE,30904
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.0rc0.dist-info/METADATA,sha256=Ut5Ef7KOXi4RdpJrPljCB_QvLTVW6y9-lz1ZaSWxp0o,17804
237
- snowflake_cli_labs-2.8.0rc0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
238
- snowflake_cli_labs-2.8.0rc0.dist-info/entry_points.txt,sha256=_qdnT44fYFbH78kb6Em5jr2_26amIg3UIAvSdmqT6TY,57
239
- snowflake_cli_labs-2.8.0rc0.dist-info/licenses/LICENSE,sha256=mJMA3Uz2AbjU_kVggo1CAx01XhBsI7BSi2H7ggUg_-c,11344
240
- snowflake_cli_labs-2.8.0rc0.dist-info/RECORD,,
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,,