snowflake-cli 3.2.2__py3-none-any.whl → 3.3.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/constants.py +4 -0
- snowflake/cli/_app/snow_connector.py +12 -0
- snowflake/cli/_app/telemetry.py +10 -3
- snowflake/cli/_plugins/connection/util.py +12 -19
- snowflake/cli/_plugins/helpers/commands.py +207 -1
- snowflake/cli/_plugins/nativeapp/artifacts.py +10 -4
- snowflake/cli/_plugins/nativeapp/codegen/compiler.py +41 -17
- snowflake/cli/_plugins/nativeapp/codegen/setup/native_app_setup_processor.py +7 -0
- snowflake/cli/_plugins/nativeapp/codegen/snowpark/python_processor.py +4 -1
- snowflake/cli/_plugins/nativeapp/codegen/templates/templates_processor.py +42 -32
- snowflake/cli/_plugins/nativeapp/commands.py +92 -2
- snowflake/cli/_plugins/nativeapp/constants.py +5 -0
- snowflake/cli/_plugins/nativeapp/entities/application.py +221 -288
- snowflake/cli/_plugins/nativeapp/entities/application_package.py +772 -89
- snowflake/cli/_plugins/nativeapp/entities/application_package_child_interface.py +43 -0
- snowflake/cli/_plugins/nativeapp/feature_flags.py +5 -1
- snowflake/cli/_plugins/nativeapp/release_channel/__init__.py +13 -0
- snowflake/cli/_plugins/nativeapp/release_channel/commands.py +212 -0
- snowflake/cli/_plugins/nativeapp/release_directive/__init__.py +13 -0
- snowflake/cli/_plugins/nativeapp/release_directive/commands.py +165 -0
- snowflake/cli/_plugins/nativeapp/same_account_install_method.py +9 -17
- snowflake/cli/_plugins/nativeapp/sf_facade_exceptions.py +80 -0
- snowflake/cli/_plugins/nativeapp/sf_sql_facade.py +999 -75
- snowflake/cli/_plugins/nativeapp/utils.py +11 -0
- snowflake/cli/_plugins/nativeapp/v2_conversions/compat.py +5 -1
- snowflake/cli/_plugins/nativeapp/version/commands.py +31 -4
- snowflake/cli/_plugins/notebook/manager.py +4 -2
- snowflake/cli/_plugins/snowpark/snowpark_entity.py +234 -4
- snowflake/cli/_plugins/spcs/common.py +129 -0
- snowflake/cli/_plugins/spcs/services/commands.py +134 -14
- snowflake/cli/_plugins/spcs/services/manager.py +169 -1
- snowflake/cli/_plugins/stage/manager.py +12 -4
- snowflake/cli/_plugins/streamlit/manager.py +8 -1
- snowflake/cli/_plugins/streamlit/streamlit_entity.py +153 -2
- snowflake/cli/_plugins/workspace/commands.py +3 -2
- snowflake/cli/_plugins/workspace/manager.py +8 -4
- snowflake/cli/api/cli_global_context.py +22 -1
- snowflake/cli/api/config.py +6 -2
- snowflake/cli/api/connections.py +12 -1
- snowflake/cli/api/constants.py +9 -1
- snowflake/cli/api/entities/common.py +85 -0
- snowflake/cli/api/entities/utils.py +9 -8
- snowflake/cli/api/errno.py +60 -3
- snowflake/cli/api/feature_flags.py +20 -4
- snowflake/cli/api/metrics.py +21 -27
- snowflake/cli/api/project/definition_conversion.py +1 -2
- snowflake/cli/api/project/schemas/project_definition.py +27 -6
- snowflake/cli/api/project/schemas/v1/streamlit/streamlit.py +1 -1
- snowflake/cli/api/project/util.py +45 -0
- {snowflake_cli-3.2.2.dist-info → snowflake_cli-3.3.0.dist-info}/METADATA +12 -12
- {snowflake_cli-3.2.2.dist-info → snowflake_cli-3.3.0.dist-info}/RECORD +55 -50
- {snowflake_cli-3.2.2.dist-info → snowflake_cli-3.3.0.dist-info}/WHEEL +1 -1
- {snowflake_cli-3.2.2.dist-info → snowflake_cli-3.3.0.dist-info}/entry_points.txt +0 -0
- {snowflake_cli-3.2.2.dist-info → snowflake_cli-3.3.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -22,6 +22,7 @@ from textwrap import dedent
|
|
|
22
22
|
from typing import Generator, Iterable, List, Optional, cast
|
|
23
23
|
|
|
24
24
|
import typer
|
|
25
|
+
from snowflake.cli._plugins.nativeapp.artifacts import VersionInfo
|
|
25
26
|
from snowflake.cli._plugins.nativeapp.common_flags import (
|
|
26
27
|
ForceOption,
|
|
27
28
|
InteractiveOption,
|
|
@@ -31,6 +32,13 @@ from snowflake.cli._plugins.nativeapp.entities.application import ApplicationEnt
|
|
|
31
32
|
from snowflake.cli._plugins.nativeapp.entities.application_package import (
|
|
32
33
|
ApplicationPackageEntityModel,
|
|
33
34
|
)
|
|
35
|
+
from snowflake.cli._plugins.nativeapp.release_channel.commands import (
|
|
36
|
+
app as release_channels_app,
|
|
37
|
+
)
|
|
38
|
+
from snowflake.cli._plugins.nativeapp.release_directive.commands import (
|
|
39
|
+
app as release_directives_app,
|
|
40
|
+
)
|
|
41
|
+
from snowflake.cli._plugins.nativeapp.sf_facade import get_snowflake_facade
|
|
34
42
|
from snowflake.cli._plugins.nativeapp.v2_conversions.compat import (
|
|
35
43
|
find_entity,
|
|
36
44
|
force_project_definition_v2,
|
|
@@ -66,6 +74,8 @@ app = SnowTyperFactory(
|
|
|
66
74
|
help="Manages a Snowflake Native App",
|
|
67
75
|
)
|
|
68
76
|
app.add_typer(versions_app)
|
|
77
|
+
app.add_typer(release_directives_app)
|
|
78
|
+
app.add_typer(release_channels_app)
|
|
69
79
|
|
|
70
80
|
log = logging.getLogger(__name__)
|
|
71
81
|
|
|
@@ -146,6 +156,12 @@ def app_run(
|
|
|
146
156
|
The command fails if no release directive exists for your Snowflake account for a given application package, which is determined from the project definition file. Default: unset.""",
|
|
147
157
|
is_flag=True,
|
|
148
158
|
),
|
|
159
|
+
channel: str = typer.Option(
|
|
160
|
+
None,
|
|
161
|
+
show_default=False,
|
|
162
|
+
help=f"""The name of the release channel to use when creating or upgrading an application instance from a release directive.
|
|
163
|
+
Requires the `--from-release-directive` flag to be set. If unset, the default channel will be used.""",
|
|
164
|
+
),
|
|
149
165
|
interactive: bool = InteractiveOption,
|
|
150
166
|
force: Optional[bool] = ForceOption,
|
|
151
167
|
validate: bool = ValidateOption,
|
|
@@ -174,6 +190,7 @@ def app_run(
|
|
|
174
190
|
paths=[],
|
|
175
191
|
interactive=interactive,
|
|
176
192
|
force=force,
|
|
193
|
+
release_channel=channel,
|
|
177
194
|
)
|
|
178
195
|
app = ws.get_entity(app_id)
|
|
179
196
|
return MessageResult(
|
|
@@ -198,7 +215,7 @@ def app_open(
|
|
|
198
215
|
)
|
|
199
216
|
app_id = options["app_entity_id"]
|
|
200
217
|
app = ws.get_entity(app_id)
|
|
201
|
-
if
|
|
218
|
+
if get_snowflake_facade().get_existing_app_info(app.name, app.role):
|
|
202
219
|
typer.launch(app.get_snowsight_url())
|
|
203
220
|
return MessageResult(f"Snowflake Native App opened in browser.")
|
|
204
221
|
else:
|
|
@@ -357,7 +374,10 @@ def app_validate(
|
|
|
357
374
|
if cli_context.output_format == OutputFormat.JSON:
|
|
358
375
|
return ObjectResult(
|
|
359
376
|
package.get_validation_result(
|
|
360
|
-
|
|
377
|
+
action_ctx=ws.action_ctx,
|
|
378
|
+
use_scratch_stage=True,
|
|
379
|
+
interactive=False,
|
|
380
|
+
force=True,
|
|
361
381
|
)
|
|
362
382
|
)
|
|
363
383
|
|
|
@@ -513,3 +533,73 @@ class EventResult(ObjectResult, MessageResult):
|
|
|
513
533
|
@property
|
|
514
534
|
def result(self):
|
|
515
535
|
return self._element
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
@app.command("publish", requires_connection=True)
|
|
539
|
+
@with_project_definition()
|
|
540
|
+
@force_project_definition_v2()
|
|
541
|
+
def app_publish(
|
|
542
|
+
version: Optional[str] = typer.Option(
|
|
543
|
+
default=None,
|
|
544
|
+
show_default=False,
|
|
545
|
+
help="The version to publish to the provided release channel and release directive. Version is required to exist unless `--create-version` flag is used.",
|
|
546
|
+
),
|
|
547
|
+
patch: Optional[int] = typer.Option(
|
|
548
|
+
default=None,
|
|
549
|
+
show_default=False,
|
|
550
|
+
help="The patch number under the given version. This will be used when setting the release directive. Patch is required to exist unless `--create-version` flag is used.",
|
|
551
|
+
),
|
|
552
|
+
channel: Optional[str] = typer.Option(
|
|
553
|
+
"DEFAULT",
|
|
554
|
+
help="The name of the release channel to publish to. If not provided, the default release channel is used.",
|
|
555
|
+
),
|
|
556
|
+
directive: Optional[str] = typer.Option(
|
|
557
|
+
"DEFAULT",
|
|
558
|
+
help="The name of the release directive to update with the specified version and patch. If not provided, the default release directive is used.",
|
|
559
|
+
),
|
|
560
|
+
interactive: bool = InteractiveOption,
|
|
561
|
+
force: Optional[bool] = ForceOption,
|
|
562
|
+
create_version: bool = typer.Option(
|
|
563
|
+
False,
|
|
564
|
+
"--create-version",
|
|
565
|
+
help="Create a new version or patch based on the provided `--version` and `--patch` values. Fallback to the manifest values if not provided.",
|
|
566
|
+
is_flag=True,
|
|
567
|
+
),
|
|
568
|
+
from_stage: bool = typer.Option(
|
|
569
|
+
False,
|
|
570
|
+
"--from-stage",
|
|
571
|
+
help="When enabled, the Snowflake CLI creates a version from the current application package stage without syncing to the stage first. Can only be used with `--create-version` flag.",
|
|
572
|
+
is_flag=True,
|
|
573
|
+
),
|
|
574
|
+
label: Optional[str] = typer.Option(
|
|
575
|
+
None,
|
|
576
|
+
"--label",
|
|
577
|
+
help="A label for the version that is displayed to consumers. Can only be used with `--create-version` flag.",
|
|
578
|
+
),
|
|
579
|
+
**options,
|
|
580
|
+
) -> CommandResult:
|
|
581
|
+
"""
|
|
582
|
+
Adds the version to the release channel and updates the release directive with the new version and patch.
|
|
583
|
+
"""
|
|
584
|
+
cli_context = get_cli_context()
|
|
585
|
+
ws = WorkspaceManager(
|
|
586
|
+
project_definition=cli_context.project_definition,
|
|
587
|
+
project_root=cli_context.project_root,
|
|
588
|
+
)
|
|
589
|
+
package_id = options["package_entity_id"]
|
|
590
|
+
version_info: VersionInfo = ws.perform_action(
|
|
591
|
+
package_id,
|
|
592
|
+
EntityActions.PUBLISH,
|
|
593
|
+
version=version,
|
|
594
|
+
patch=patch,
|
|
595
|
+
release_channel=channel,
|
|
596
|
+
release_directive=directive,
|
|
597
|
+
interactive=interactive,
|
|
598
|
+
force=force,
|
|
599
|
+
create_version=create_version,
|
|
600
|
+
from_stage=from_stage,
|
|
601
|
+
label=label,
|
|
602
|
+
)
|
|
603
|
+
return MessageResult(
|
|
604
|
+
f"Version {version_info.version_name} and patch {version_info.patch_number} published to release directive {directive} of release channel {channel}."
|
|
605
|
+
)
|
|
@@ -22,7 +22,12 @@ COMMENT_COL = "comment"
|
|
|
22
22
|
OWNER_COL = "owner"
|
|
23
23
|
VERSION_COL = "version"
|
|
24
24
|
PATCH_COL = "patch"
|
|
25
|
+
CHANNEL_COL = "release_channel_name"
|
|
25
26
|
AUTHORIZE_TELEMETRY_COL = "authorize_telemetry_event_sharing"
|
|
26
27
|
|
|
27
28
|
INTERNAL_DISTRIBUTION = "internal"
|
|
28
29
|
EXTERNAL_DISTRIBUTION = "external"
|
|
30
|
+
|
|
31
|
+
DEFAULT_CHANNEL = "DEFAULT"
|
|
32
|
+
DEFAULT_DIRECTIVE = "DEFAULT"
|
|
33
|
+
MAX_VERSIONS_IN_RELEASE_CHANNEL = 2
|