snowflake-cli-labs 3.0.0rc4__py3-none-any.whl → 3.0.1__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.
Files changed (244) hide show
  1. README.md +21 -0
  2. {snowflake_cli_labs-3.0.0rc4.dist-info → snowflake_cli_labs-3.0.1.dist-info}/METADATA +6 -96
  3. snowflake_cli_labs-3.0.1.dist-info/RECORD +5 -0
  4. snowflake/cli/__about__.py +0 -17
  5. snowflake/cli/__init__.py +0 -13
  6. snowflake/cli/_app/__init__.py +0 -22
  7. snowflake/cli/_app/__main__.py +0 -31
  8. snowflake/cli/_app/api_impl/__init__.py +0 -13
  9. snowflake/cli/_app/api_impl/plugin/__init__.py +0 -13
  10. snowflake/cli/_app/api_impl/plugin/plugin_config_provider_impl.py +0 -66
  11. snowflake/cli/_app/cli_app.py +0 -252
  12. snowflake/cli/_app/commands_registration/__init__.py +0 -33
  13. snowflake/cli/_app/commands_registration/builtin_plugins.py +0 -50
  14. snowflake/cli/_app/commands_registration/command_plugins_loader.py +0 -169
  15. snowflake/cli/_app/commands_registration/commands_registration_with_callbacks.py +0 -105
  16. snowflake/cli/_app/commands_registration/exception_logging.py +0 -26
  17. snowflake/cli/_app/commands_registration/threadsafe.py +0 -48
  18. snowflake/cli/_app/commands_registration/typer_registration.py +0 -153
  19. snowflake/cli/_app/constants.py +0 -19
  20. snowflake/cli/_app/dev/__init__.py +0 -13
  21. snowflake/cli/_app/dev/commands_structure.py +0 -48
  22. snowflake/cli/_app/dev/docs/__init__.py +0 -13
  23. snowflake/cli/_app/dev/docs/commands_docs_generator.py +0 -118
  24. snowflake/cli/_app/dev/docs/generator.py +0 -35
  25. snowflake/cli/_app/dev/docs/project_definition_docs_generator.py +0 -58
  26. snowflake/cli/_app/dev/docs/project_definition_generate_json_schema.py +0 -227
  27. snowflake/cli/_app/dev/docs/template_utils.py +0 -23
  28. snowflake/cli/_app/dev/docs/templates/definition_description.rst.jinja2 +0 -38
  29. snowflake/cli/_app/dev/docs/templates/overview.rst.jinja2 +0 -9
  30. snowflake/cli/_app/dev/docs/templates/usage.rst.jinja2 +0 -67
  31. snowflake/cli/_app/dev/pycharm_remote_debug.py +0 -46
  32. snowflake/cli/_app/loggers.py +0 -199
  33. snowflake/cli/_app/main_typer.py +0 -62
  34. snowflake/cli/_app/printing.py +0 -181
  35. snowflake/cli/_app/secret.py +0 -9
  36. snowflake/cli/_app/snow_connector.py +0 -309
  37. snowflake/cli/_app/telemetry.py +0 -220
  38. snowflake/cli/_app/version_check.py +0 -74
  39. snowflake/cli/_plugins/__init__.py +0 -13
  40. snowflake/cli/_plugins/connection/__init__.py +0 -13
  41. snowflake/cli/_plugins/connection/commands.py +0 -353
  42. snowflake/cli/_plugins/connection/plugin_spec.py +0 -30
  43. snowflake/cli/_plugins/connection/util.py +0 -195
  44. snowflake/cli/_plugins/cortex/__init__.py +0 -13
  45. snowflake/cli/_plugins/cortex/commands.py +0 -332
  46. snowflake/cli/_plugins/cortex/constants.py +0 -17
  47. snowflake/cli/_plugins/cortex/manager.py +0 -189
  48. snowflake/cli/_plugins/cortex/plugin_spec.py +0 -30
  49. snowflake/cli/_plugins/cortex/types.py +0 -22
  50. snowflake/cli/_plugins/git/__init__.py +0 -13
  51. snowflake/cli/_plugins/git/commands.py +0 -358
  52. snowflake/cli/_plugins/git/manager.py +0 -151
  53. snowflake/cli/_plugins/git/plugin_spec.py +0 -30
  54. snowflake/cli/_plugins/helpers/__init__.py +0 -13
  55. snowflake/cli/_plugins/helpers/commands.py +0 -61
  56. snowflake/cli/_plugins/helpers/plugin_spec.py +0 -30
  57. snowflake/cli/_plugins/init/__init__.py +0 -13
  58. snowflake/cli/_plugins/init/commands.py +0 -248
  59. snowflake/cli/_plugins/init/plugin_spec.py +0 -30
  60. snowflake/cli/_plugins/nativeapp/__init__.py +0 -13
  61. snowflake/cli/_plugins/nativeapp/artifacts.py +0 -757
  62. snowflake/cli/_plugins/nativeapp/bundle_context.py +0 -31
  63. snowflake/cli/_plugins/nativeapp/codegen/__init__.py +0 -13
  64. snowflake/cli/_plugins/nativeapp/codegen/artifact_processor.py +0 -91
  65. snowflake/cli/_plugins/nativeapp/codegen/compiler.py +0 -149
  66. snowflake/cli/_plugins/nativeapp/codegen/sandbox.py +0 -306
  67. snowflake/cli/_plugins/nativeapp/codegen/setup/native_app_setup_processor.py +0 -249
  68. snowflake/cli/_plugins/nativeapp/codegen/setup/setup_driver.py.source +0 -59
  69. snowflake/cli/_plugins/nativeapp/codegen/snowpark/callback_source.py.jinja +0 -181
  70. snowflake/cli/_plugins/nativeapp/codegen/snowpark/extension_function_utils.py +0 -217
  71. snowflake/cli/_plugins/nativeapp/codegen/snowpark/models.py +0 -61
  72. snowflake/cli/_plugins/nativeapp/codegen/snowpark/python_processor.py +0 -523
  73. snowflake/cli/_plugins/nativeapp/codegen/templates/templates_processor.py +0 -114
  74. snowflake/cli/_plugins/nativeapp/commands.py +0 -559
  75. snowflake/cli/_plugins/nativeapp/common_flags.py +0 -44
  76. snowflake/cli/_plugins/nativeapp/constants.py +0 -27
  77. snowflake/cli/_plugins/nativeapp/entities/__init__.py +0 -0
  78. snowflake/cli/_plugins/nativeapp/entities/application.py +0 -878
  79. snowflake/cli/_plugins/nativeapp/entities/application_package.py +0 -1392
  80. snowflake/cli/_plugins/nativeapp/exceptions.py +0 -113
  81. snowflake/cli/_plugins/nativeapp/feature_flags.py +0 -24
  82. snowflake/cli/_plugins/nativeapp/manager.py +0 -415
  83. snowflake/cli/_plugins/nativeapp/plugin_spec.py +0 -30
  84. snowflake/cli/_plugins/nativeapp/policy.py +0 -53
  85. snowflake/cli/_plugins/nativeapp/project_model.py +0 -211
  86. snowflake/cli/_plugins/nativeapp/run_processor.py +0 -184
  87. snowflake/cli/_plugins/nativeapp/same_account_install_method.py +0 -70
  88. snowflake/cli/_plugins/nativeapp/teardown_processor.py +0 -70
  89. snowflake/cli/_plugins/nativeapp/utils.py +0 -98
  90. snowflake/cli/_plugins/nativeapp/v2_conversions/v2_to_v1_decorator.py +0 -262
  91. snowflake/cli/_plugins/nativeapp/version/__init__.py +0 -13
  92. snowflake/cli/_plugins/nativeapp/version/commands.py +0 -141
  93. snowflake/cli/_plugins/nativeapp/version/version_processor.py +0 -98
  94. snowflake/cli/_plugins/notebook/__init__.py +0 -13
  95. snowflake/cli/_plugins/notebook/commands.py +0 -86
  96. snowflake/cli/_plugins/notebook/exceptions.py +0 -20
  97. snowflake/cli/_plugins/notebook/manager.py +0 -71
  98. snowflake/cli/_plugins/notebook/plugin_spec.py +0 -30
  99. snowflake/cli/_plugins/notebook/types.py +0 -15
  100. snowflake/cli/_plugins/object/__init__.py +0 -13
  101. snowflake/cli/_plugins/object/command_aliases.py +0 -95
  102. snowflake/cli/_plugins/object/commands.py +0 -180
  103. snowflake/cli/_plugins/object/common.py +0 -85
  104. snowflake/cli/_plugins/object/manager.py +0 -118
  105. snowflake/cli/_plugins/object/plugin_spec.py +0 -30
  106. snowflake/cli/_plugins/snowpark/__init__.py +0 -13
  107. snowflake/cli/_plugins/snowpark/commands.py +0 -450
  108. snowflake/cli/_plugins/snowpark/common.py +0 -268
  109. snowflake/cli/_plugins/snowpark/models.py +0 -150
  110. snowflake/cli/_plugins/snowpark/package/__init__.py +0 -13
  111. snowflake/cli/_plugins/snowpark/package/anaconda_packages.py +0 -199
  112. snowflake/cli/_plugins/snowpark/package/commands.py +0 -195
  113. snowflake/cli/_plugins/snowpark/package/manager.py +0 -44
  114. snowflake/cli/_plugins/snowpark/package/utils.py +0 -26
  115. snowflake/cli/_plugins/snowpark/package_utils.py +0 -354
  116. snowflake/cli/_plugins/snowpark/plugin_spec.py +0 -30
  117. snowflake/cli/_plugins/snowpark/snowpark_entity.py +0 -29
  118. snowflake/cli/_plugins/snowpark/snowpark_entity_model.py +0 -173
  119. snowflake/cli/_plugins/snowpark/snowpark_project_paths.py +0 -109
  120. snowflake/cli/_plugins/snowpark/snowpark_shared.py +0 -59
  121. snowflake/cli/_plugins/snowpark/zipper.py +0 -89
  122. snowflake/cli/_plugins/spcs/__init__.py +0 -33
  123. snowflake/cli/_plugins/spcs/common.py +0 -99
  124. snowflake/cli/_plugins/spcs/compute_pool/__init__.py +0 -13
  125. snowflake/cli/_plugins/spcs/compute_pool/commands.py +0 -241
  126. snowflake/cli/_plugins/spcs/compute_pool/manager.py +0 -121
  127. snowflake/cli/_plugins/spcs/image_registry/__init__.py +0 -13
  128. snowflake/cli/_plugins/spcs/image_registry/commands.py +0 -65
  129. snowflake/cli/_plugins/spcs/image_registry/manager.py +0 -105
  130. snowflake/cli/_plugins/spcs/image_repository/__init__.py +0 -13
  131. snowflake/cli/_plugins/spcs/image_repository/commands.py +0 -202
  132. snowflake/cli/_plugins/spcs/image_repository/manager.py +0 -84
  133. snowflake/cli/_plugins/spcs/plugin_spec.py +0 -30
  134. snowflake/cli/_plugins/spcs/services/__init__.py +0 -13
  135. snowflake/cli/_plugins/spcs/services/commands.py +0 -345
  136. snowflake/cli/_plugins/spcs/services/manager.py +0 -208
  137. snowflake/cli/_plugins/sql/__init__.py +0 -13
  138. snowflake/cli/_plugins/sql/commands.py +0 -86
  139. snowflake/cli/_plugins/sql/manager.py +0 -92
  140. snowflake/cli/_plugins/sql/plugin_spec.py +0 -30
  141. snowflake/cli/_plugins/sql/snowsql_templating.py +0 -28
  142. snowflake/cli/_plugins/stage/__init__.py +0 -13
  143. snowflake/cli/_plugins/stage/commands.py +0 -264
  144. snowflake/cli/_plugins/stage/diff.py +0 -280
  145. snowflake/cli/_plugins/stage/manager.py +0 -582
  146. snowflake/cli/_plugins/stage/md5.py +0 -160
  147. snowflake/cli/_plugins/stage/plugin_spec.py +0 -30
  148. snowflake/cli/_plugins/stage/utils.py +0 -54
  149. snowflake/cli/_plugins/streamlit/__init__.py +0 -13
  150. snowflake/cli/_plugins/streamlit/commands.py +0 -195
  151. snowflake/cli/_plugins/streamlit/manager.py +0 -220
  152. snowflake/cli/_plugins/streamlit/plugin_spec.py +0 -30
  153. snowflake/cli/_plugins/streamlit/streamlit_entity.py +0 -12
  154. snowflake/cli/_plugins/streamlit/streamlit_entity_model.py +0 -66
  155. snowflake/cli/_plugins/workspace/__init__.py +0 -13
  156. snowflake/cli/_plugins/workspace/action_context.py +0 -18
  157. snowflake/cli/_plugins/workspace/commands.py +0 -306
  158. snowflake/cli/_plugins/workspace/manager.py +0 -74
  159. snowflake/cli/_plugins/workspace/plugin_spec.py +0 -30
  160. snowflake/cli/api/__init__.py +0 -48
  161. snowflake/cli/api/cli_global_context.py +0 -247
  162. snowflake/cli/api/commands/__init__.py +0 -13
  163. snowflake/cli/api/commands/alias.py +0 -23
  164. snowflake/cli/api/commands/common.py +0 -25
  165. snowflake/cli/api/commands/decorators.py +0 -369
  166. snowflake/cli/api/commands/execution_metadata.py +0 -40
  167. snowflake/cli/api/commands/experimental_behaviour.py +0 -18
  168. snowflake/cli/api/commands/flags.py +0 -561
  169. snowflake/cli/api/commands/overrideable_parameter.py +0 -143
  170. snowflake/cli/api/commands/snow_typer.py +0 -247
  171. snowflake/cli/api/commands/utils.py +0 -18
  172. snowflake/cli/api/config.py +0 -380
  173. snowflake/cli/api/connections.py +0 -216
  174. snowflake/cli/api/console/__init__.py +0 -17
  175. snowflake/cli/api/console/abc.py +0 -94
  176. snowflake/cli/api/console/console.py +0 -134
  177. snowflake/cli/api/console/enum.py +0 -17
  178. snowflake/cli/api/constants.py +0 -90
  179. snowflake/cli/api/entities/common.py +0 -56
  180. snowflake/cli/api/entities/utils.py +0 -370
  181. snowflake/cli/api/errno.py +0 -28
  182. snowflake/cli/api/exceptions.py +0 -190
  183. snowflake/cli/api/feature_flags.py +0 -54
  184. snowflake/cli/api/identifiers.py +0 -190
  185. snowflake/cli/api/metrics.py +0 -92
  186. snowflake/cli/api/output/__init__.py +0 -13
  187. snowflake/cli/api/output/formats.py +0 -20
  188. snowflake/cli/api/output/types.py +0 -118
  189. snowflake/cli/api/plugins/__init__.py +0 -13
  190. snowflake/cli/api/plugins/command/__init__.py +0 -72
  191. snowflake/cli/api/plugins/command/plugin_hook_specs.py +0 -21
  192. snowflake/cli/api/plugins/plugin_config.py +0 -32
  193. snowflake/cli/api/project/__init__.py +0 -13
  194. snowflake/cli/api/project/definition.py +0 -126
  195. snowflake/cli/api/project/definition_conversion.py +0 -395
  196. snowflake/cli/api/project/definition_manager.py +0 -145
  197. snowflake/cli/api/project/errors.py +0 -56
  198. snowflake/cli/api/project/project_verification.py +0 -23
  199. snowflake/cli/api/project/schemas/__init__.py +0 -13
  200. snowflake/cli/api/project/schemas/entities/__init__.py +0 -13
  201. snowflake/cli/api/project/schemas/entities/common.py +0 -153
  202. snowflake/cli/api/project/schemas/entities/entities.py +0 -61
  203. snowflake/cli/api/project/schemas/project_definition.py +0 -330
  204. snowflake/cli/api/project/schemas/template.py +0 -77
  205. snowflake/cli/api/project/schemas/updatable_model.py +0 -202
  206. snowflake/cli/api/project/schemas/v1/__init__.py +0 -0
  207. snowflake/cli/api/project/schemas/v1/identifier_model.py +0 -51
  208. snowflake/cli/api/project/schemas/v1/native_app/__init__.py +0 -0
  209. snowflake/cli/api/project/schemas/v1/native_app/application.py +0 -61
  210. snowflake/cli/api/project/schemas/v1/native_app/native_app.py +0 -93
  211. snowflake/cli/api/project/schemas/v1/native_app/package.py +0 -84
  212. snowflake/cli/api/project/schemas/v1/native_app/path_mapping.py +0 -65
  213. snowflake/cli/api/project/schemas/v1/snowpark/__init__.py +0 -0
  214. snowflake/cli/api/project/schemas/v1/snowpark/argument.py +0 -28
  215. snowflake/cli/api/project/schemas/v1/snowpark/callable.py +0 -69
  216. snowflake/cli/api/project/schemas/v1/snowpark/snowpark.py +0 -36
  217. snowflake/cli/api/project/schemas/v1/streamlit/__init__.py +0 -0
  218. snowflake/cli/api/project/schemas/v1/streamlit/streamlit.py +0 -47
  219. snowflake/cli/api/project/util.py +0 -278
  220. snowflake/cli/api/rendering/__init__.py +0 -13
  221. snowflake/cli/api/rendering/jinja.py +0 -118
  222. snowflake/cli/api/rendering/project_definition_templates.py +0 -43
  223. snowflake/cli/api/rendering/project_templates.py +0 -98
  224. snowflake/cli/api/rendering/sql_templates.py +0 -105
  225. snowflake/cli/api/rest_api.py +0 -178
  226. snowflake/cli/api/sanitizers.py +0 -43
  227. snowflake/cli/api/secure_path.py +0 -360
  228. snowflake/cli/api/secure_utils.py +0 -118
  229. snowflake/cli/api/sql_execution.py +0 -280
  230. snowflake/cli/api/utils/__init__.py +0 -13
  231. snowflake/cli/api/utils/cursor.py +0 -34
  232. snowflake/cli/api/utils/definition_rendering.py +0 -415
  233. snowflake/cli/api/utils/dict_utils.py +0 -73
  234. snowflake/cli/api/utils/error_handling.py +0 -23
  235. snowflake/cli/api/utils/graph.py +0 -97
  236. snowflake/cli/api/utils/models.py +0 -63
  237. snowflake/cli/api/utils/naming_utils.py +0 -13
  238. snowflake/cli/api/utils/path_utils.py +0 -36
  239. snowflake/cli/api/utils/templating_functions.py +0 -144
  240. snowflake/cli/api/utils/types.py +0 -35
  241. snowflake_cli_labs-3.0.0rc4.dist-info/RECORD +0 -242
  242. snowflake_cli_labs-3.0.0rc4.dist-info/entry_points.txt +0 -2
  243. {snowflake_cli_labs-3.0.0rc4.dist-info → snowflake_cli_labs-3.0.1.dist-info}/WHEEL +0 -0
  244. {snowflake_cli_labs-3.0.0rc4.dist-info → snowflake_cli_labs-3.0.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,61 +0,0 @@
1
- # Copyright (c) 2024 Snowflake Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- from __future__ import annotations
16
-
17
- from typing import List, Optional
18
-
19
- from pydantic import Field, field_validator
20
- from snowflake.cli.api.project.schemas.entities.common import PostDeployHook
21
- from snowflake.cli.api.project.schemas.updatable_model import (
22
- IdentifierField,
23
- UpdatableModel,
24
- )
25
- from snowflake.cli.api.project.util import append_test_resource_suffix
26
-
27
-
28
- class Application(UpdatableModel):
29
- role: Optional[str] = Field(
30
- title="Role to use when creating the application object and consumer-side objects",
31
- default=None,
32
- )
33
- name: Optional[str] = Field(
34
- title="Name of the application object created when you run the snow app run command",
35
- default=None,
36
- )
37
- warehouse: Optional[str] = IdentifierField(
38
- title="Name of the application object created when you run the snow app run command",
39
- default=None,
40
- )
41
- debug: Optional[bool] = Field(
42
- title="When set, forces debug_mode on/off for the deployed application object",
43
- default=None,
44
- )
45
- post_deploy: Optional[List[PostDeployHook]] = Field(
46
- title="Actions that will be executed after the application object is created/upgraded",
47
- default=None,
48
- )
49
-
50
- @field_validator("name")
51
- @classmethod
52
- def append_test_resource_suffix_to_name(cls, input_value: str) -> str:
53
- return append_test_resource_suffix(input_value)
54
-
55
-
56
- class ApplicationV11(Application):
57
- # Templated defaults only supported in v1.1+
58
- name: Optional[str] = Field(
59
- title="Name of the application object created when you run the snow app run command",
60
- default="<% fn.concat_ids(ctx.native_app.name, '_', fn.sanitize_id(fn.get_username('unknown_user')) | lower) %>",
61
- )
@@ -1,93 +0,0 @@
1
- # Copyright (c) 2024 Snowflake Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- from __future__ import annotations
16
-
17
- import re
18
- from typing import List, Optional, Union
19
-
20
- from pydantic import Field, field_validator
21
- from snowflake.cli.api.project.schemas.updatable_model import UpdatableModel
22
- from snowflake.cli.api.project.schemas.v1.native_app.application import (
23
- Application,
24
- ApplicationV11,
25
- )
26
- from snowflake.cli.api.project.schemas.v1.native_app.package import Package, PackageV11
27
- from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import PathMapping
28
- from snowflake.cli.api.project.util import (
29
- SCHEMA_AND_NAME,
30
- )
31
-
32
-
33
- class NativeApp(UpdatableModel):
34
- name: str = Field(
35
- title="Project identifier",
36
- )
37
- artifacts: List[Union[PathMapping, str]] = Field(
38
- title="List of file source and destination pairs to add to the deploy root",
39
- )
40
- bundle_root: Optional[str] = Field(
41
- title="Folder at the root of your project where artifacts necessary to perform the bundle step are stored.",
42
- default="output/bundle/",
43
- )
44
- deploy_root: Optional[str] = Field(
45
- title="Folder at the root of your project where the bundle step copies the artifacts.",
46
- default="output/deploy/",
47
- )
48
- generated_root: Optional[str] = Field(
49
- title="Subdirectory of the deploy root where files generated by the Snowflake CLI will be written.",
50
- default="__generated/",
51
- )
52
- source_stage: Optional[str] = Field(
53
- title="Identifier of the stage that stores the application artifacts.",
54
- default="app_src.stage",
55
- )
56
- scratch_stage: Optional[str] = Field(
57
- title="Identifier of the stage that stores temporary scratch data used by the Snowflake CLI.",
58
- default="app_src.stage_snowflake_cli_scratch",
59
- )
60
- package: Optional[Package] = Field(title="PackageSchema", default=None)
61
- application: Optional[Application] = Field(title="Application info", default=None)
62
-
63
- @field_validator("source_stage")
64
- @classmethod
65
- def validate_source_stage(cls, input_value: str):
66
- if not re.match(SCHEMA_AND_NAME, input_value):
67
- raise ValueError("Incorrect value for source_stage value of native_app")
68
- return input_value
69
-
70
- @field_validator("artifacts")
71
- @classmethod
72
- def transform_artifacts(
73
- cls, orig_artifacts: List[Union[PathMapping, str]]
74
- ) -> List[PathMapping]:
75
- transformed_artifacts = []
76
- if orig_artifacts is None:
77
- return transformed_artifacts
78
-
79
- for artifact in orig_artifacts:
80
- if isinstance(artifact, PathMapping):
81
- transformed_artifacts.append(artifact)
82
- else:
83
- transformed_artifacts.append(PathMapping(src=artifact))
84
-
85
- return transformed_artifacts
86
-
87
-
88
- class NativeAppV11(NativeApp):
89
- # templated defaults are only supported with version 1.1+
90
- package: Optional[PackageV11] = Field(title="PackageSchema", default=PackageV11())
91
- application: Optional[ApplicationV11] = Field(
92
- title="Application info", default=ApplicationV11()
93
- )
@@ -1,84 +0,0 @@
1
- # Copyright (c) 2024 Snowflake Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- from __future__ import annotations
16
-
17
- from typing import List, Literal, Optional
18
-
19
- from pydantic import Field, field_validator, model_validator
20
- from snowflake.cli.api.project.schemas.entities.common import PostDeployHook
21
- from snowflake.cli.api.project.schemas.updatable_model import (
22
- IdentifierField,
23
- UpdatableModel,
24
- )
25
- from snowflake.cli.api.project.util import append_test_resource_suffix
26
-
27
- DistributionOptions = Literal["internal", "external", "INTERNAL", "EXTERNAL"]
28
-
29
-
30
- class Package(UpdatableModel):
31
- scripts: Optional[List[str]] = Field(
32
- title="List of SQL file paths relative to the project root", default=None
33
- )
34
- role: Optional[str] = IdentifierField(
35
- title="Role to use when creating the application package and provider-side objects",
36
- default=None,
37
- )
38
- name: Optional[str] = IdentifierField(
39
- title="Name of the application package created when you run the snow app run command",
40
- default=None,
41
- )
42
- warehouse: Optional[str] = IdentifierField(
43
- title="Warehouse used to run the scripts", default=None
44
- )
45
- distribution: Optional[DistributionOptions] = Field(
46
- title="Distribution of the application package created by the Snowflake CLI",
47
- default="internal",
48
- )
49
- post_deploy: Optional[List[PostDeployHook]] = Field(
50
- title="Actions that will be executed after the application package object is created/updated",
51
- default=None,
52
- )
53
-
54
- @field_validator("name")
55
- @classmethod
56
- def append_test_resource_suffix_to_name(cls, input_value: str) -> str:
57
- return append_test_resource_suffix(input_value)
58
-
59
- @field_validator("scripts")
60
- @classmethod
61
- def validate_scripts(cls, input_list):
62
- if len(input_list) != len(set(input_list)):
63
- raise ValueError(
64
- "package.scripts field should contain unique values. Check the list for duplicates and try again"
65
- )
66
- return input_list
67
-
68
- @model_validator(mode="after")
69
- @classmethod
70
- def validate_no_scripts_and_post_deploy(cls, value: Package):
71
- if value.scripts and value.post_deploy:
72
- raise ValueError(
73
- "package.scripts and package.post_deploy fields cannot be used together. "
74
- "We recommend using package.post_deploy for all post package deploy scripts"
75
- )
76
- return value
77
-
78
-
79
- class PackageV11(Package):
80
- # Templated defaults only supported in v1.1+
81
- name: Optional[str] = IdentifierField(
82
- title="Name of the application package created when you run the snow app run command",
83
- default="<% fn.concat_ids(ctx.native_app.name, '_pkg_', fn.sanitize_id(fn.get_username('unknown_user')) | lower) %>",
84
- )
@@ -1,65 +0,0 @@
1
- # Copyright (c) 2024 Snowflake Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- from __future__ import annotations
16
-
17
- from typing import Any, Dict, List, Optional, Union
18
-
19
- from pydantic import Field, field_validator
20
- from snowflake.cli.api.project.schemas.updatable_model import UpdatableModel
21
-
22
-
23
- class ProcessorMapping(UpdatableModel):
24
- name: str = Field(
25
- title="Name of a processor to invoke on a collection of artifacts."
26
- )
27
- properties: Optional[Dict[str, Any]] = Field(
28
- title="A set of key-value pairs used to configure the output of the processor. Consult a specific processor's documentation for more details on the supported properties.",
29
- default=None,
30
- )
31
-
32
-
33
- class PathMapping(UpdatableModel):
34
- src: str = Field(
35
- title="Source path or glob pattern (relative to project root)", default=None
36
- )
37
-
38
- dest: Optional[str] = Field(
39
- title="Destination path on stage",
40
- description="Paths are relative to stage root; paths ending with a slash indicate that the destination is a directory which source files should be copied into.",
41
- default=None,
42
- )
43
-
44
- processors: Optional[List[Union[str, ProcessorMapping]]] = Field(
45
- title="List of processors to apply to matching source files during bundling.",
46
- default=[],
47
- )
48
-
49
- @field_validator("processors")
50
- @classmethod
51
- def transform_processors(
52
- cls, input_values: Optional[List[Union[str, Dict, ProcessorMapping]]]
53
- ) -> List[ProcessorMapping]:
54
- if input_values is None:
55
- return []
56
-
57
- transformed_processors: List[ProcessorMapping] = []
58
- for input_processor in input_values:
59
- if isinstance(input_processor, str):
60
- transformed_processors.append(ProcessorMapping(name=input_processor))
61
- elif isinstance(input_processor, Dict):
62
- transformed_processors.append(ProcessorMapping(**input_processor))
63
- else:
64
- transformed_processors.append(input_processor)
65
- return transformed_processors
File without changes
@@ -1,28 +0,0 @@
1
- # Copyright (c) 2024 Snowflake Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- from __future__ import annotations
16
-
17
- from typing import Optional
18
-
19
- from pydantic import Field
20
- from snowflake.cli.api.project.schemas.updatable_model import UpdatableModel
21
-
22
-
23
- class Argument(UpdatableModel):
24
- name: str = Field(title="Name of the argument")
25
- arg_type: str = Field(
26
- title="Type of the argument", alias="type"
27
- ) # TODO: consider introducing literal/enum here
28
- default: Optional[str] = Field(title="Default value for an argument", default=None)
@@ -1,69 +0,0 @@
1
- # Copyright (c) 2024 Snowflake Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- from __future__ import annotations
16
-
17
- from typing import Dict, List, Optional, Union
18
-
19
- from pydantic import Field, field_validator
20
- from snowflake.cli.api.project.schemas.updatable_model import UpdatableModel
21
- from snowflake.cli.api.project.schemas.v1.identifier_model import ObjectIdentifierModel
22
- from snowflake.cli.api.project.schemas.v1.snowpark.argument import Argument
23
-
24
-
25
- class _CallableBase(UpdatableModel):
26
- handler: str = Field(
27
- title="Function’s or procedure’s implementation of the object inside source module",
28
- examples=["functions.hello_function"],
29
- )
30
- returns: str = Field(
31
- title="Type of the result"
32
- ) # TODO: again, consider Literal/Enum
33
- signature: Union[str, List[Argument]] = Field(
34
- title="The signature parameter describes consecutive arguments passed to the object"
35
- )
36
- runtime: Optional[Union[str, float]] = Field(
37
- title="Python version to use when executing ", default=None
38
- )
39
- external_access_integrations: Optional[List[str]] = Field(
40
- title="Names of external access integrations needed for this procedure’s handler code to access external networks",
41
- default=[],
42
- )
43
- secrets: Optional[Dict[str, str]] = Field(
44
- title="Assigns the names of secrets to variables so that you can use the variables to reference the secrets",
45
- default={},
46
- )
47
- imports: Optional[List[str]] = Field(
48
- title="Stage and path to previously uploaded files you want to import",
49
- default=[],
50
- )
51
-
52
- @field_validator("runtime")
53
- @classmethod
54
- def convert_runtime(cls, runtime_input: Union[str, float]) -> str:
55
- if isinstance(runtime_input, float):
56
- return str(runtime_input)
57
- return runtime_input
58
-
59
-
60
- class FunctionSchema(_CallableBase, ObjectIdentifierModel(object_name="function")): # type: ignore
61
- pass
62
-
63
-
64
- class ProcedureSchema(_CallableBase, ObjectIdentifierModel(object_name="procedure")): # type: ignore
65
- execute_as_caller: Optional[bool] = Field(
66
- title="Determine whether the procedure is executed with the privileges of "
67
- "the owner (you) or with the privileges of the caller",
68
- default=False,
69
- )
@@ -1,36 +0,0 @@
1
- # Copyright (c) 2024 Snowflake Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- from __future__ import annotations
16
-
17
- from typing import List, Optional
18
-
19
- from pydantic import Field
20
- from snowflake.cli.api.project.schemas.updatable_model import UpdatableModel
21
- from snowflake.cli.api.project.schemas.v1.snowpark.callable import (
22
- FunctionSchema,
23
- ProcedureSchema,
24
- )
25
-
26
-
27
- class Snowpark(UpdatableModel):
28
- project_name: str = Field(title="Project identifier")
29
- stage_name: str = Field(title="Stage in which project’s artifacts will be stored")
30
- src: str = Field(title="Folder where your code should be located")
31
- functions: Optional[List[FunctionSchema]] = Field(
32
- title="List of functions defined in the project", default=[]
33
- )
34
- procedures: Optional[List[ProcedureSchema]] = Field(
35
- title="List of procedures defined in the project", default=[]
36
- )
@@ -1,47 +0,0 @@
1
- # Copyright (c) 2024 Snowflake Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- from __future__ import annotations
16
-
17
- from pathlib import Path
18
- from typing import List, Optional
19
-
20
- from pydantic import Field
21
- from snowflake.cli.api.project.schemas.updatable_model import UpdatableModel
22
- from snowflake.cli.api.project.schemas.v1.identifier_model import ObjectIdentifierModel
23
-
24
-
25
- class Streamlit(UpdatableModel, ObjectIdentifierModel(object_name="Streamlit")): # type: ignore
26
- stage: Optional[str] = Field(
27
- title="Stage in which the app’s artifacts will be stored", default="streamlit"
28
- )
29
- query_warehouse: str = Field(
30
- title="Snowflake warehouse to host the app", default="streamlit"
31
- )
32
- main_file: Optional[Path] = Field(
33
- title="Entrypoint file of the Streamlit app", default="streamlit_app.py"
34
- )
35
- env_file: Optional[Path] = Field(
36
- title="File defining additional configurations for the app, such as external dependencies",
37
- default=None,
38
- )
39
- pages_dir: Optional[Path] = Field(title="Streamlit pages", default=None)
40
- additional_source_files: Optional[List[Path]] = Field(
41
- title="List of additional files which should be included into deployment artifacts",
42
- default=None,
43
- )
44
- title: Optional[str] = Field(
45
- title="Human-readable title for the Streamlit dashboard", default=None
46
- )
47
- comment: Optional[str] = Field(title="Comment for the Streamlit app", default=None)