snowflake-cli 3.3.0__py3-none-any.whl → 3.5.0__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/_app/__main__.py +2 -2
- snowflake/cli/_app/cli_app.py +220 -197
- snowflake/cli/_app/commands_registration/builtin_plugins.py +5 -1
- snowflake/cli/_app/commands_registration/command_plugins_loader.py +3 -1
- snowflake/cli/_app/commands_registration/commands_registration_with_callbacks.py +4 -30
- snowflake/cli/_app/printing.py +2 -2
- snowflake/cli/_plugins/connection/commands.py +2 -4
- snowflake/cli/_plugins/cortex/commands.py +2 -4
- snowflake/cli/_plugins/git/manager.py +1 -1
- snowflake/cli/_plugins/helpers/commands.py +3 -4
- snowflake/cli/_plugins/nativeapp/artifacts.py +6 -624
- snowflake/cli/_plugins/nativeapp/bundle_context.py +1 -1
- snowflake/cli/_plugins/nativeapp/codegen/artifact_processor.py +1 -1
- snowflake/cli/_plugins/nativeapp/codegen/compiler.py +1 -3
- snowflake/cli/_plugins/nativeapp/codegen/setup/native_app_setup_processor.py +2 -2
- snowflake/cli/_plugins/nativeapp/codegen/snowpark/python_processor.py +2 -2
- snowflake/cli/_plugins/nativeapp/codegen/templates/templates_processor.py +2 -2
- snowflake/cli/_plugins/nativeapp/commands.py +21 -19
- snowflake/cli/_plugins/nativeapp/entities/application.py +16 -19
- snowflake/cli/_plugins/nativeapp/entities/application_package.py +142 -55
- snowflake/cli/_plugins/nativeapp/release_channel/commands.py +37 -3
- snowflake/cli/_plugins/nativeapp/release_directive/commands.py +80 -2
- snowflake/cli/_plugins/nativeapp/sf_sql_facade.py +224 -44
- snowflake/cli/_plugins/nativeapp/v2_conversions/compat.py +2 -2
- snowflake/cli/_plugins/nativeapp/version/commands.py +1 -1
- snowflake/cli/_plugins/notebook/commands.py +54 -2
- snowflake/cli/_plugins/notebook/exceptions.py +1 -1
- snowflake/cli/_plugins/notebook/manager.py +3 -3
- snowflake/cli/_plugins/notebook/notebook_entity.py +120 -0
- snowflake/cli/_plugins/notebook/notebook_entity_model.py +42 -0
- snowflake/cli/_plugins/notebook/notebook_project_paths.py +15 -0
- snowflake/cli/_plugins/notebook/types.py +3 -0
- snowflake/cli/_plugins/plugin/commands.py +79 -0
- snowflake/cli/_plugins/plugin/manager.py +74 -0
- snowflake/cli/_plugins/plugin/plugin_spec.py +30 -0
- snowflake/cli/_plugins/project/__init__.py +0 -0
- snowflake/cli/_plugins/project/commands.py +157 -0
- snowflake/cli/_plugins/project/feature_flags.py +22 -0
- snowflake/cli/_plugins/project/manager.py +76 -0
- snowflake/cli/_plugins/project/plugin_spec.py +30 -0
- snowflake/cli/_plugins/project/project_entity_model.py +40 -0
- snowflake/cli/_plugins/snowpark/commands.py +49 -30
- snowflake/cli/_plugins/snowpark/common.py +47 -2
- snowflake/cli/_plugins/snowpark/snowpark_entity.py +38 -25
- snowflake/cli/_plugins/snowpark/snowpark_entity_model.py +18 -30
- snowflake/cli/_plugins/snowpark/snowpark_project_paths.py +156 -23
- snowflake/cli/_plugins/snowpark/zipper.py +33 -1
- snowflake/cli/_plugins/spcs/compute_pool/commands.py +53 -5
- snowflake/cli/_plugins/spcs/compute_pool/compute_pool_entity.py +8 -0
- snowflake/cli/_plugins/spcs/compute_pool/compute_pool_entity_model.py +37 -0
- snowflake/cli/_plugins/spcs/compute_pool/manager.py +45 -0
- snowflake/cli/_plugins/spcs/image_repository/commands.py +29 -0
- snowflake/cli/_plugins/spcs/image_repository/image_repository_entity.py +8 -0
- snowflake/cli/_plugins/spcs/image_repository/image_repository_entity_model.py +8 -0
- snowflake/cli/_plugins/spcs/image_repository/manager.py +1 -1
- snowflake/cli/_plugins/spcs/services/commands.py +51 -1
- snowflake/cli/_plugins/spcs/services/manager.py +114 -0
- snowflake/cli/_plugins/spcs/services/service_entity.py +6 -0
- snowflake/cli/_plugins/spcs/services/service_entity_model.py +45 -0
- snowflake/cli/_plugins/spcs/services/service_project_paths.py +15 -0
- snowflake/cli/_plugins/stage/commands.py +2 -1
- snowflake/cli/_plugins/stage/diff.py +60 -39
- snowflake/cli/_plugins/stage/manager.py +26 -13
- snowflake/cli/_plugins/stage/utils.py +1 -1
- snowflake/cli/_plugins/streamlit/commands.py +18 -24
- snowflake/cli/_plugins/streamlit/manager.py +37 -27
- snowflake/cli/_plugins/streamlit/streamlit_entity.py +20 -41
- snowflake/cli/_plugins/streamlit/streamlit_entity_model.py +14 -24
- snowflake/cli/_plugins/streamlit/streamlit_project_paths.py +30 -0
- snowflake/cli/_plugins/workspace/commands.py +3 -3
- snowflake/cli/_plugins/workspace/manager.py +1 -1
- snowflake/cli/api/artifacts/bundle_map.py +500 -0
- snowflake/cli/api/artifacts/common.py +78 -0
- snowflake/cli/api/artifacts/upload.py +51 -0
- snowflake/cli/api/artifacts/utils.py +82 -0
- snowflake/cli/api/cli_global_context.py +14 -1
- snowflake/cli/api/commands/flags.py +34 -13
- snowflake/cli/api/commands/snow_typer.py +12 -0
- snowflake/cli/api/commands/utils.py +30 -2
- snowflake/cli/api/config.py +15 -10
- snowflake/cli/api/constants.py +1 -0
- snowflake/cli/api/entities/common.py +14 -32
- snowflake/cli/api/entities/resolver.py +160 -0
- snowflake/cli/api/entities/utils.py +56 -15
- snowflake/cli/api/errno.py +3 -0
- snowflake/cli/api/exceptions.py +8 -1
- snowflake/cli/api/feature_flags.py +1 -1
- snowflake/cli/api/plugins/plugin_config.py +43 -4
- snowflake/cli/api/project/definition_conversion.py +3 -2
- snowflake/cli/api/project/definition_helper.py +31 -0
- snowflake/cli/api/project/project_paths.py +28 -0
- snowflake/cli/api/project/schemas/entities/common.py +130 -1
- snowflake/cli/api/project/schemas/entities/entities.py +30 -0
- snowflake/cli/api/project/schemas/project_definition.py +27 -0
- snowflake/cli/api/project/schemas/updatable_model.py +2 -2
- snowflake/cli/api/project/schemas/v1/native_app/native_app.py +5 -7
- snowflake/cli/api/secure_path.py +6 -0
- snowflake/cli/api/sql_execution.py +5 -1
- snowflake/cli/api/stage_path.py +7 -2
- snowflake/cli/api/utils/graph.py +3 -0
- snowflake/cli/api/utils/path_utils.py +24 -0
- {snowflake_cli-3.3.0.dist-info → snowflake_cli-3.5.0.dist-info}/METADATA +12 -13
- {snowflake_cli-3.3.0.dist-info → snowflake_cli-3.5.0.dist-info}/RECORD +109 -85
- snowflake/cli/_app/api_impl/plugin/plugin_config_provider_impl.py +0 -66
- snowflake/cli/api/__init__.py +0 -48
- snowflake/cli/api/project/schemas/v1/native_app/path_mapping.py +0 -65
- /snowflake/cli/{_app/api_impl → _plugins/plugin}/__init__.py +0 -0
- /snowflake/cli/{_app/api_impl/plugin → api/artifacts}/__init__.py +0 -0
- {snowflake_cli-3.3.0.dist-info → snowflake_cli-3.5.0.dist-info}/WHEEL +0 -0
- {snowflake_cli-3.3.0.dist-info → snowflake_cli-3.5.0.dist-info}/entry_points.txt +0 -0
- {snowflake_cli-3.3.0.dist-info → snowflake_cli-3.5.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
17
|
import logging
|
|
18
|
-
from pathlib import Path
|
|
19
18
|
from typing import List, Optional
|
|
20
19
|
|
|
21
20
|
from click import ClickException
|
|
@@ -29,12 +28,17 @@ from snowflake.cli._plugins.stage.manager import StageManager
|
|
|
29
28
|
from snowflake.cli._plugins.streamlit.streamlit_entity_model import (
|
|
30
29
|
StreamlitEntityModel,
|
|
31
30
|
)
|
|
31
|
+
from snowflake.cli._plugins.streamlit.streamlit_project_paths import (
|
|
32
|
+
StreamlitProjectPaths,
|
|
33
|
+
)
|
|
34
|
+
from snowflake.cli.api.artifacts.upload import put_files
|
|
32
35
|
from snowflake.cli.api.commands.experimental_behaviour import (
|
|
33
36
|
experimental_behaviour_enabled,
|
|
34
37
|
)
|
|
35
38
|
from snowflake.cli.api.console import cli_console
|
|
36
39
|
from snowflake.cli.api.feature_flags import FeatureFlag
|
|
37
40
|
from snowflake.cli.api.identifiers import FQN
|
|
41
|
+
from snowflake.cli.api.project.schemas.entities.common import PathMapping
|
|
38
42
|
from snowflake.cli.api.sql_execution import SqlExecutionMixin
|
|
39
43
|
from snowflake.connector.cursor import SnowflakeCursor
|
|
40
44
|
from snowflake.connector.errors import ProgrammingError
|
|
@@ -54,26 +58,16 @@ class StreamlitManager(SqlExecutionMixin):
|
|
|
54
58
|
|
|
55
59
|
def _put_streamlit_files(
|
|
56
60
|
self,
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
streamlit_project_paths: StreamlitProjectPaths,
|
|
62
|
+
stage_root: str,
|
|
63
|
+
artifacts: Optional[List[PathMapping]] = None,
|
|
59
64
|
):
|
|
60
|
-
cli_console.step(f"Deploying files to {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if not any(file.iterdir()):
|
|
67
|
-
cli_console.warning(f"Skipping empty directory: {file}")
|
|
68
|
-
continue
|
|
69
|
-
|
|
70
|
-
stage_manager.put(
|
|
71
|
-
f"{file.joinpath('*')}", f"{root_location}/{file}", 4, True
|
|
72
|
-
)
|
|
73
|
-
elif len(file.parts) > 1:
|
|
74
|
-
stage_manager.put(file, f"{root_location}/{file.parent}", 4, True)
|
|
75
|
-
else:
|
|
76
|
-
stage_manager.put(file, root_location, 4, True)
|
|
65
|
+
cli_console.step(f"Deploying files to {stage_root}")
|
|
66
|
+
put_files(
|
|
67
|
+
project_paths=streamlit_project_paths,
|
|
68
|
+
stage_root=stage_root,
|
|
69
|
+
artifacts=artifacts,
|
|
70
|
+
)
|
|
77
71
|
|
|
78
72
|
def _create_streamlit(
|
|
79
73
|
self,
|
|
@@ -127,7 +121,12 @@ class StreamlitManager(SqlExecutionMixin):
|
|
|
127
121
|
|
|
128
122
|
self.execute_query("\n".join(query))
|
|
129
123
|
|
|
130
|
-
def deploy(
|
|
124
|
+
def deploy(
|
|
125
|
+
self,
|
|
126
|
+
streamlit: StreamlitEntityModel,
|
|
127
|
+
streamlit_project_paths: StreamlitProjectPaths,
|
|
128
|
+
replace: bool = False,
|
|
129
|
+
):
|
|
131
130
|
streamlit_id = streamlit.fqn.using_connection(self._conn)
|
|
132
131
|
if (
|
|
133
132
|
ObjectManager().object_exists(object_type="streamlit", fqn=streamlit_id)
|
|
@@ -179,12 +178,13 @@ class StreamlitManager(SqlExecutionMixin):
|
|
|
179
178
|
embedded_stage_name = f"snow://streamlit/{stage_path}"
|
|
180
179
|
if use_versioned_stage:
|
|
181
180
|
# "LIVE" is the only supported version for now, but this may change later.
|
|
182
|
-
|
|
181
|
+
stage_root = f"{embedded_stage_name}/versions/live"
|
|
183
182
|
else:
|
|
184
|
-
|
|
183
|
+
stage_root = f"{embedded_stage_name}/default_checkout"
|
|
185
184
|
|
|
186
185
|
self._put_streamlit_files(
|
|
187
|
-
|
|
186
|
+
streamlit_project_paths,
|
|
187
|
+
stage_root,
|
|
188
188
|
streamlit.artifacts,
|
|
189
189
|
)
|
|
190
190
|
else:
|
|
@@ -201,21 +201,31 @@ class StreamlitManager(SqlExecutionMixin):
|
|
|
201
201
|
cli_console.step(f"Creating {stage_name} stage")
|
|
202
202
|
stage_manager.create(fqn=stage_name)
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
stage_root = stage_manager.get_standard_stage_prefix(
|
|
205
205
|
f"{stage_name}/{streamlit_name_for_root_location}"
|
|
206
206
|
)
|
|
207
207
|
|
|
208
|
-
self._put_streamlit_files(
|
|
208
|
+
self._put_streamlit_files(
|
|
209
|
+
streamlit_project_paths, stage_root, streamlit.artifacts
|
|
210
|
+
)
|
|
209
211
|
|
|
210
212
|
self._create_streamlit(
|
|
211
213
|
streamlit=streamlit,
|
|
212
214
|
replace=replace,
|
|
213
|
-
from_stage_name=
|
|
215
|
+
from_stage_name=stage_root,
|
|
214
216
|
experimental=False,
|
|
215
217
|
)
|
|
216
218
|
|
|
219
|
+
self.grant_privileges(streamlit)
|
|
220
|
+
|
|
217
221
|
return self.get_url(streamlit_name=streamlit_id)
|
|
218
222
|
|
|
223
|
+
def grant_privileges(self, entity_model: StreamlitEntityModel):
|
|
224
|
+
if not entity_model.grants:
|
|
225
|
+
return
|
|
226
|
+
for grant in entity_model.grants:
|
|
227
|
+
self.execute_query(grant.get_grant_sql(entity_model))
|
|
228
|
+
|
|
219
229
|
def get_url(self, streamlit_name: FQN) -> str:
|
|
220
230
|
try:
|
|
221
231
|
fqn = streamlit_name.using_connection(self._conn)
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import functools
|
|
2
1
|
from pathlib import Path
|
|
3
2
|
from typing import Optional
|
|
4
3
|
|
|
5
4
|
from click import ClickException
|
|
6
5
|
from snowflake.cli._plugins.connection.util import make_snowsight_url
|
|
6
|
+
from snowflake.cli._plugins.nativeapp.artifacts import build_bundle
|
|
7
7
|
from snowflake.cli._plugins.nativeapp.feature_flags import FeatureFlag
|
|
8
8
|
from snowflake.cli._plugins.streamlit.streamlit_entity_model import (
|
|
9
9
|
StreamlitEntityModel,
|
|
10
10
|
)
|
|
11
11
|
from snowflake.cli._plugins.workspace.context import ActionContext
|
|
12
|
-
from snowflake.cli.api.entities.common import EntityBase
|
|
13
|
-
from snowflake.cli.api.
|
|
12
|
+
from snowflake.cli.api.entities.common import EntityBase
|
|
13
|
+
from snowflake.cli.api.project.project_paths import bundle_root
|
|
14
|
+
from snowflake.cli.api.project.schemas.entities.common import PathMapping
|
|
14
15
|
from snowflake.connector.cursor import SnowflakeCursor
|
|
15
16
|
|
|
16
17
|
|
|
@@ -32,18 +33,6 @@ class StreamlitEntity(EntityBase[StreamlitEntityModel]):
|
|
|
32
33
|
def artifacts(self):
|
|
33
34
|
return self._entity_model.artifacts
|
|
34
35
|
|
|
35
|
-
@functools.cached_property
|
|
36
|
-
def _sql_executor(self):
|
|
37
|
-
return get_sql_executor()
|
|
38
|
-
|
|
39
|
-
@functools.cached_property
|
|
40
|
-
def _conn(self):
|
|
41
|
-
return self._sql_executor._conn # noqa
|
|
42
|
-
|
|
43
|
-
@property
|
|
44
|
-
def model(self):
|
|
45
|
-
return self._entity_model # noqa
|
|
46
|
-
|
|
47
36
|
def action_bundle(self, action_ctx: ActionContext, *args, **kwargs):
|
|
48
37
|
return self.bundle()
|
|
49
38
|
|
|
@@ -51,15 +40,15 @@ class StreamlitEntity(EntityBase[StreamlitEntityModel]):
|
|
|
51
40
|
# After adding bundle map- we should use it's mapping here
|
|
52
41
|
# To copy artifacts to destination on stage.
|
|
53
42
|
|
|
54
|
-
return self.
|
|
43
|
+
return self.deploy()
|
|
55
44
|
|
|
56
45
|
def action_drop(self, action_ctx: ActionContext, *args, **kwargs):
|
|
57
|
-
return self.
|
|
46
|
+
return self._execute_query(self.get_drop_sql())
|
|
58
47
|
|
|
59
48
|
def action_execute(
|
|
60
49
|
self, action_ctx: ActionContext, *args, **kwargs
|
|
61
50
|
) -> SnowflakeCursor:
|
|
62
|
-
return self.
|
|
51
|
+
return self._execute_query(self.get_execute_sql())
|
|
63
52
|
|
|
64
53
|
def action_get_url(
|
|
65
54
|
self, action_ctx: ActionContext, *args, **kwargs
|
|
@@ -70,34 +59,24 @@ class StreamlitEntity(EntityBase[StreamlitEntityModel]):
|
|
|
70
59
|
)
|
|
71
60
|
|
|
72
61
|
def bundle(self, output_dir: Optional[Path] = None):
|
|
62
|
+
build_bundle(
|
|
63
|
+
self.root,
|
|
64
|
+
output_dir or bundle_root(self.root, "streamlit"),
|
|
65
|
+
[
|
|
66
|
+
PathMapping(
|
|
67
|
+
src=artifact.src, dest=artifact.dest, processors=artifact.processors
|
|
68
|
+
)
|
|
69
|
+
for artifact in self._entity_model.artifacts
|
|
70
|
+
],
|
|
71
|
+
)
|
|
73
72
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
artifacts = self._entity_model.artifacts
|
|
78
|
-
|
|
79
|
-
output_dir.mkdir(parents=True, exist_ok=True) # type: ignore
|
|
80
|
-
|
|
81
|
-
output_files = []
|
|
82
|
-
|
|
83
|
-
# This is far from , but will be replaced by bundlemap mappings.
|
|
84
|
-
for file in artifacts:
|
|
85
|
-
output_file = output_dir / file.name
|
|
86
|
-
|
|
87
|
-
if file.is_file():
|
|
88
|
-
SecurePath(file).copy(output_file)
|
|
89
|
-
elif file.is_dir():
|
|
90
|
-
output_file.mkdir(parents=True, exist_ok=True)
|
|
91
|
-
SecurePath(file).copy(output_file, dirs_exist_ok=True)
|
|
92
|
-
|
|
93
|
-
output_files.append(output_file)
|
|
94
|
-
|
|
95
|
-
return output_files
|
|
73
|
+
def deploy(self, *args, **kwargs):
|
|
74
|
+
return self._execute_query(self.get_deploy_sql())
|
|
96
75
|
|
|
97
76
|
def action_share(
|
|
98
77
|
self, action_ctx: ActionContext, to_role: str, *args, **kwargs
|
|
99
78
|
) -> SnowflakeCursor:
|
|
100
|
-
return self.
|
|
79
|
+
return self._execute_query(self.get_share_sql(to_role))
|
|
101
80
|
|
|
102
81
|
def get_deploy_sql(
|
|
103
82
|
self,
|
|
@@ -13,13 +13,14 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
from __future__ import annotations
|
|
15
15
|
|
|
16
|
-
from
|
|
17
|
-
from typing import List, Literal, Optional
|
|
16
|
+
from typing import Literal, Optional
|
|
18
17
|
|
|
19
|
-
from pydantic import Field
|
|
18
|
+
from pydantic import Field
|
|
20
19
|
from snowflake.cli.api.project.schemas.entities.common import (
|
|
21
|
-
|
|
20
|
+
Artifacts,
|
|
21
|
+
EntityModelBaseWithArtifacts,
|
|
22
22
|
ExternalAccessBaseModel,
|
|
23
|
+
GrantBaseModel,
|
|
23
24
|
ImportsBaseModel,
|
|
24
25
|
)
|
|
25
26
|
from snowflake.cli.api.project.schemas.updatable_model import (
|
|
@@ -27,7 +28,12 @@ from snowflake.cli.api.project.schemas.updatable_model import (
|
|
|
27
28
|
)
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
class StreamlitEntityModel(
|
|
31
|
+
class StreamlitEntityModel(
|
|
32
|
+
EntityModelBaseWithArtifacts,
|
|
33
|
+
ExternalAccessBaseModel,
|
|
34
|
+
ImportsBaseModel,
|
|
35
|
+
GrantBaseModel,
|
|
36
|
+
):
|
|
31
37
|
type: Literal["streamlit"] = DiscriminatorField() # noqa: A003
|
|
32
38
|
title: Optional[str] = Field(
|
|
33
39
|
title="Human-readable title for the Streamlit dashboard", default=None
|
|
@@ -43,24 +49,8 @@ class StreamlitEntityModel(EntityModelBase, ExternalAccessBaseModel, ImportsBase
|
|
|
43
49
|
stage: Optional[str] = Field(
|
|
44
50
|
title="Stage in which the app’s artifacts will be stored", default="streamlit"
|
|
45
51
|
)
|
|
46
|
-
#
|
|
47
|
-
artifacts: Optional[
|
|
48
|
-
title="List of
|
|
49
|
-
"Main file needs to be included in the artifacts.",
|
|
52
|
+
# Artifacts were optional, so to avoid BCR, we need to make them optional here as well
|
|
53
|
+
artifacts: Optional[Artifacts] = Field(
|
|
54
|
+
title="List of paths or file source/destination pairs to add to the deploy root",
|
|
50
55
|
default=None,
|
|
51
56
|
)
|
|
52
|
-
|
|
53
|
-
@model_validator(mode="after")
|
|
54
|
-
def artifacts_must_exists(self):
|
|
55
|
-
if not self.artifacts:
|
|
56
|
-
return self
|
|
57
|
-
|
|
58
|
-
for artifact in self.artifacts:
|
|
59
|
-
if "*" in artifact.name:
|
|
60
|
-
continue
|
|
61
|
-
if not artifact.exists():
|
|
62
|
-
raise ValueError(
|
|
63
|
-
f"Specified artifact {artifact} does not exist locally."
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
return self
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
from dataclasses import dataclass
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
from snowflake.cli.api.project.project_paths import ProjectPaths, bundle_root
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass
|
|
23
|
+
class StreamlitProjectPaths(ProjectPaths):
|
|
24
|
+
"""
|
|
25
|
+
This class allows you to manage files paths related to given project.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def bundle_root(self) -> Path:
|
|
30
|
+
return bundle_root(self.project_root, "streamlit")
|
|
@@ -22,17 +22,17 @@ from typing import List, Optional
|
|
|
22
22
|
|
|
23
23
|
import typer
|
|
24
24
|
import yaml
|
|
25
|
-
from snowflake.cli._plugins.nativeapp.artifacts import BundleMap
|
|
26
25
|
from snowflake.cli._plugins.nativeapp.common_flags import (
|
|
27
26
|
ForceOption,
|
|
28
27
|
InteractiveOption,
|
|
29
28
|
ValidateOption,
|
|
30
29
|
)
|
|
31
30
|
from snowflake.cli._plugins.workspace.manager import WorkspaceManager
|
|
31
|
+
from snowflake.cli.api.artifacts.bundle_map import BundleMap
|
|
32
32
|
from snowflake.cli.api.cli_global_context import get_cli_context
|
|
33
33
|
from snowflake.cli.api.commands.decorators import with_project_definition
|
|
34
34
|
from snowflake.cli.api.commands.snow_typer import SnowTyperFactory
|
|
35
|
-
from snowflake.cli.api.entities.
|
|
35
|
+
from snowflake.cli.api.entities.utils import EntityActions
|
|
36
36
|
from snowflake.cli.api.exceptions import IncompatibleParametersError
|
|
37
37
|
from snowflake.cli.api.output.types import CollectionResult, MessageResult
|
|
38
38
|
|
|
@@ -106,7 +106,7 @@ def deploy(
|
|
|
106
106
|
show_default=False,
|
|
107
107
|
help=dedent(
|
|
108
108
|
f"""
|
|
109
|
-
Paths, relative to the
|
|
109
|
+
Paths, relative to the project root, of files or directories you want to upload to a stage. If a file is
|
|
110
110
|
specified, it must match one of the artifacts src pattern entries in snowflake.yml. If a directory is
|
|
111
111
|
specified, it will be searched for subfolders or files to deploy based on artifacts src pattern entries. If
|
|
112
112
|
unspecified, the command syncs all local changes to the stage."""
|
|
@@ -5,7 +5,7 @@ from typing import Dict
|
|
|
5
5
|
from snowflake.cli._plugins.workspace.context import ActionContext, WorkspaceContext
|
|
6
6
|
from snowflake.cli.api.cli_global_context import get_cli_context
|
|
7
7
|
from snowflake.cli.api.console import cli_console as cc
|
|
8
|
-
from snowflake.cli.api.entities.
|
|
8
|
+
from snowflake.cli.api.entities.utils import EntityActions, get_sql_executor
|
|
9
9
|
from snowflake.cli.api.exceptions import InvalidProjectDefinitionVersionError
|
|
10
10
|
from snowflake.cli.api.project.definition import default_role
|
|
11
11
|
from snowflake.cli.api.project.schemas.entities.entities import (
|