snowflake-cli-labs 2.8.1__py3-none-any.whl → 2.8.2__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.
- README.md +21 -0
- {snowflake_cli_labs-2.8.1.dist-info → snowflake_cli_labs-2.8.2.dist-info}/METADATA +7 -95
- snowflake_cli_labs-2.8.2.dist-info/RECORD +5 -0
- snowflake/cli/__about__.py +0 -17
- snowflake/cli/__init__.py +0 -13
- snowflake/cli/api/__init__.py +0 -48
- snowflake/cli/api/cli_global_context.py +0 -390
- snowflake/cli/api/commands/__init__.py +0 -13
- snowflake/cli/api/commands/alias.py +0 -23
- snowflake/cli/api/commands/decorators.py +0 -354
- snowflake/cli/api/commands/execution_metadata.py +0 -40
- snowflake/cli/api/commands/experimental_behaviour.py +0 -19
- snowflake/cli/api/commands/flags.py +0 -662
- snowflake/cli/api/commands/project_initialisation.py +0 -65
- snowflake/cli/api/commands/snow_typer.py +0 -237
- snowflake/cli/api/commands/typer_pre_execute.py +0 -26
- snowflake/cli/api/config.py +0 -348
- snowflake/cli/api/console/__init__.py +0 -17
- snowflake/cli/api/console/abc.py +0 -89
- snowflake/cli/api/console/console.py +0 -134
- snowflake/cli/api/console/enum.py +0 -17
- snowflake/cli/api/constants.py +0 -79
- snowflake/cli/api/errno.py +0 -27
- snowflake/cli/api/exceptions.py +0 -164
- snowflake/cli/api/feature_flags.py +0 -55
- snowflake/cli/api/identifiers.py +0 -167
- snowflake/cli/api/output/__init__.py +0 -13
- snowflake/cli/api/output/formats.py +0 -20
- snowflake/cli/api/output/types.py +0 -118
- snowflake/cli/api/plugins/__init__.py +0 -13
- snowflake/cli/api/plugins/command/__init__.py +0 -72
- snowflake/cli/api/plugins/command/plugin_hook_specs.py +0 -21
- snowflake/cli/api/plugins/plugin_config.py +0 -32
- snowflake/cli/api/project/__init__.py +0 -13
- snowflake/cli/api/project/definition.py +0 -84
- snowflake/cli/api/project/definition_manager.py +0 -134
- snowflake/cli/api/project/errors.py +0 -56
- snowflake/cli/api/project/project_verification.py +0 -23
- snowflake/cli/api/project/schemas/__init__.py +0 -13
- snowflake/cli/api/project/schemas/entities/application_entity.py +0 -44
- snowflake/cli/api/project/schemas/entities/application_package_entity.py +0 -66
- snowflake/cli/api/project/schemas/entities/common.py +0 -78
- snowflake/cli/api/project/schemas/entities/entities.py +0 -30
- snowflake/cli/api/project/schemas/identifier_model.py +0 -49
- snowflake/cli/api/project/schemas/native_app/__init__.py +0 -13
- snowflake/cli/api/project/schemas/native_app/application.py +0 -62
- snowflake/cli/api/project/schemas/native_app/native_app.py +0 -93
- snowflake/cli/api/project/schemas/native_app/package.py +0 -78
- snowflake/cli/api/project/schemas/native_app/path_mapping.py +0 -65
- snowflake/cli/api/project/schemas/project_definition.py +0 -199
- snowflake/cli/api/project/schemas/snowpark/__init__.py +0 -13
- snowflake/cli/api/project/schemas/snowpark/argument.py +0 -28
- snowflake/cli/api/project/schemas/snowpark/callable.py +0 -69
- snowflake/cli/api/project/schemas/snowpark/snowpark.py +0 -36
- snowflake/cli/api/project/schemas/streamlit/__init__.py +0 -13
- snowflake/cli/api/project/schemas/streamlit/streamlit.py +0 -46
- snowflake/cli/api/project/schemas/template.py +0 -77
- snowflake/cli/api/project/schemas/updatable_model.py +0 -194
- snowflake/cli/api/project/util.py +0 -261
- snowflake/cli/api/rendering/__init__.py +0 -13
- snowflake/cli/api/rendering/jinja.py +0 -112
- snowflake/cli/api/rendering/project_definition_templates.py +0 -39
- snowflake/cli/api/rendering/project_templates.py +0 -98
- snowflake/cli/api/rendering/sql_templates.py +0 -60
- snowflake/cli/api/rest_api.py +0 -172
- snowflake/cli/api/sanitizers.py +0 -43
- snowflake/cli/api/secure_path.py +0 -362
- snowflake/cli/api/secure_utils.py +0 -29
- snowflake/cli/api/sql_execution.py +0 -260
- snowflake/cli/api/utils/__init__.py +0 -13
- snowflake/cli/api/utils/cursor.py +0 -34
- snowflake/cli/api/utils/definition_rendering.py +0 -383
- snowflake/cli/api/utils/dict_utils.py +0 -73
- snowflake/cli/api/utils/error_handling.py +0 -23
- snowflake/cli/api/utils/graph.py +0 -97
- snowflake/cli/api/utils/models.py +0 -63
- snowflake/cli/api/utils/naming_utils.py +0 -13
- snowflake/cli/api/utils/path_utils.py +0 -36
- snowflake/cli/api/utils/templating_functions.py +0 -144
- snowflake/cli/api/utils/types.py +0 -35
- snowflake/cli/app/__init__.py +0 -22
- snowflake/cli/app/__main__.py +0 -31
- snowflake/cli/app/api_impl/__init__.py +0 -13
- snowflake/cli/app/api_impl/plugin/__init__.py +0 -13
- snowflake/cli/app/api_impl/plugin/plugin_config_provider_impl.py +0 -66
- snowflake/cli/app/build_and_push.sh +0 -8
- snowflake/cli/app/cli_app.py +0 -243
- snowflake/cli/app/commands_registration/__init__.py +0 -33
- snowflake/cli/app/commands_registration/builtin_plugins.py +0 -54
- snowflake/cli/app/commands_registration/command_plugins_loader.py +0 -169
- snowflake/cli/app/commands_registration/commands_registration_with_callbacks.py +0 -105
- snowflake/cli/app/commands_registration/exception_logging.py +0 -26
- snowflake/cli/app/commands_registration/threadsafe.py +0 -48
- snowflake/cli/app/commands_registration/typer_registration.py +0 -153
- snowflake/cli/app/constants.py +0 -19
- snowflake/cli/app/dev/__init__.py +0 -13
- snowflake/cli/app/dev/commands_structure.py +0 -48
- snowflake/cli/app/dev/docs/__init__.py +0 -13
- snowflake/cli/app/dev/docs/commands_docs_generator.py +0 -100
- snowflake/cli/app/dev/docs/generator.py +0 -35
- snowflake/cli/app/dev/docs/project_definition_docs_generator.py +0 -58
- snowflake/cli/app/dev/docs/project_definition_generate_json_schema.py +0 -227
- snowflake/cli/app/dev/docs/template_utils.py +0 -23
- snowflake/cli/app/dev/docs/templates/definition_description.rst.jinja2 +0 -38
- snowflake/cli/app/dev/docs/templates/overview.rst.jinja2 +0 -9
- snowflake/cli/app/dev/docs/templates/usage.rst.jinja2 +0 -57
- snowflake/cli/app/dev/pycharm_remote_debug.py +0 -46
- snowflake/cli/app/loggers.py +0 -199
- snowflake/cli/app/main_typer.py +0 -62
- snowflake/cli/app/printing.py +0 -181
- snowflake/cli/app/snow_connector.py +0 -243
- snowflake/cli/app/telemetry.py +0 -189
- snowflake/cli/plugins/__init__.py +0 -13
- snowflake/cli/plugins/connection/__init__.py +0 -13
- snowflake/cli/plugins/connection/commands.py +0 -330
- snowflake/cli/plugins/connection/plugin_spec.py +0 -30
- snowflake/cli/plugins/connection/util.py +0 -179
- snowflake/cli/plugins/cortex/__init__.py +0 -13
- snowflake/cli/plugins/cortex/commands.py +0 -327
- snowflake/cli/plugins/cortex/constants.py +0 -17
- snowflake/cli/plugins/cortex/manager.py +0 -189
- snowflake/cli/plugins/cortex/plugin_spec.py +0 -30
- snowflake/cli/plugins/cortex/types.py +0 -22
- snowflake/cli/plugins/git/__init__.py +0 -13
- snowflake/cli/plugins/git/commands.py +0 -354
- snowflake/cli/plugins/git/manager.py +0 -105
- snowflake/cli/plugins/git/plugin_spec.py +0 -30
- snowflake/cli/plugins/init/__init__.py +0 -13
- snowflake/cli/plugins/init/commands.py +0 -248
- snowflake/cli/plugins/init/plugin_spec.py +0 -30
- snowflake/cli/plugins/nativeapp/__init__.py +0 -13
- snowflake/cli/plugins/nativeapp/artifacts.py +0 -742
- snowflake/cli/plugins/nativeapp/codegen/__init__.py +0 -13
- snowflake/cli/plugins/nativeapp/codegen/artifact_processor.py +0 -91
- snowflake/cli/plugins/nativeapp/codegen/compiler.py +0 -130
- snowflake/cli/plugins/nativeapp/codegen/sandbox.py +0 -306
- snowflake/cli/plugins/nativeapp/codegen/setup/native_app_setup_processor.py +0 -172
- snowflake/cli/plugins/nativeapp/codegen/setup/setup_driver.py.source +0 -56
- snowflake/cli/plugins/nativeapp/codegen/snowpark/callback_source.py.jinja +0 -181
- snowflake/cli/plugins/nativeapp/codegen/snowpark/extension_function_utils.py +0 -217
- snowflake/cli/plugins/nativeapp/codegen/snowpark/models.py +0 -61
- snowflake/cli/plugins/nativeapp/codegen/snowpark/python_processor.py +0 -528
- snowflake/cli/plugins/nativeapp/commands.py +0 -439
- snowflake/cli/plugins/nativeapp/common_flags.py +0 -44
- snowflake/cli/plugins/nativeapp/constants.py +0 -27
- snowflake/cli/plugins/nativeapp/exceptions.py +0 -122
- snowflake/cli/plugins/nativeapp/feature_flags.py +0 -24
- snowflake/cli/plugins/nativeapp/init.py +0 -345
- snowflake/cli/plugins/nativeapp/manager.py +0 -823
- snowflake/cli/plugins/nativeapp/plugin_spec.py +0 -30
- snowflake/cli/plugins/nativeapp/policy.py +0 -50
- snowflake/cli/plugins/nativeapp/project_model.py +0 -195
- snowflake/cli/plugins/nativeapp/run_processor.py +0 -389
- snowflake/cli/plugins/nativeapp/teardown_processor.py +0 -301
- snowflake/cli/plugins/nativeapp/utils.py +0 -98
- snowflake/cli/plugins/nativeapp/v2_conversions/v2_to_v1_decorator.py +0 -135
- snowflake/cli/plugins/nativeapp/version/__init__.py +0 -13
- snowflake/cli/plugins/nativeapp/version/commands.py +0 -170
- snowflake/cli/plugins/nativeapp/version/version_processor.py +0 -362
- snowflake/cli/plugins/notebook/__init__.py +0 -13
- snowflake/cli/plugins/notebook/commands.py +0 -85
- snowflake/cli/plugins/notebook/exceptions.py +0 -20
- snowflake/cli/plugins/notebook/manager.py +0 -71
- snowflake/cli/plugins/notebook/plugin_spec.py +0 -30
- snowflake/cli/plugins/notebook/types.py +0 -15
- snowflake/cli/plugins/object/__init__.py +0 -13
- snowflake/cli/plugins/object/command_aliases.py +0 -95
- snowflake/cli/plugins/object/commands.py +0 -181
- snowflake/cli/plugins/object/common.py +0 -85
- snowflake/cli/plugins/object/manager.py +0 -97
- snowflake/cli/plugins/object/plugin_spec.py +0 -30
- snowflake/cli/plugins/object_stage_deprecated/__init__.py +0 -15
- snowflake/cli/plugins/object_stage_deprecated/commands.py +0 -122
- snowflake/cli/plugins/object_stage_deprecated/plugin_spec.py +0 -32
- snowflake/cli/plugins/snowpark/__init__.py +0 -13
- snowflake/cli/plugins/snowpark/commands.py +0 -546
- snowflake/cli/plugins/snowpark/common.py +0 -307
- snowflake/cli/plugins/snowpark/manager.py +0 -109
- snowflake/cli/plugins/snowpark/models.py +0 -157
- snowflake/cli/plugins/snowpark/package/__init__.py +0 -13
- snowflake/cli/plugins/snowpark/package/anaconda_packages.py +0 -233
- snowflake/cli/plugins/snowpark/package/commands.py +0 -256
- snowflake/cli/plugins/snowpark/package/manager.py +0 -44
- snowflake/cli/plugins/snowpark/package/utils.py +0 -26
- snowflake/cli/plugins/snowpark/package_utils.py +0 -354
- snowflake/cli/plugins/snowpark/plugin_spec.py +0 -30
- snowflake/cli/plugins/snowpark/snowpark_package_paths.py +0 -65
- snowflake/cli/plugins/snowpark/snowpark_shared.py +0 -95
- snowflake/cli/plugins/snowpark/zipper.py +0 -81
- snowflake/cli/plugins/spcs/__init__.py +0 -35
- snowflake/cli/plugins/spcs/common.py +0 -99
- snowflake/cli/plugins/spcs/compute_pool/__init__.py +0 -13
- snowflake/cli/plugins/spcs/compute_pool/commands.py +0 -241
- snowflake/cli/plugins/spcs/compute_pool/manager.py +0 -121
- snowflake/cli/plugins/spcs/image_registry/__init__.py +0 -13
- snowflake/cli/plugins/spcs/image_registry/commands.py +0 -65
- snowflake/cli/plugins/spcs/image_registry/manager.py +0 -105
- snowflake/cli/plugins/spcs/image_repository/__init__.py +0 -13
- snowflake/cli/plugins/spcs/image_repository/commands.py +0 -202
- snowflake/cli/plugins/spcs/image_repository/manager.py +0 -84
- snowflake/cli/plugins/spcs/jobs/__init__.py +0 -13
- snowflake/cli/plugins/spcs/jobs/commands.py +0 -78
- snowflake/cli/plugins/spcs/jobs/manager.py +0 -53
- snowflake/cli/plugins/spcs/plugin_spec.py +0 -30
- snowflake/cli/plugins/spcs/services/__init__.py +0 -13
- snowflake/cli/plugins/spcs/services/commands.py +0 -312
- snowflake/cli/plugins/spcs/services/manager.py +0 -170
- snowflake/cli/plugins/sql/__init__.py +0 -13
- snowflake/cli/plugins/sql/commands.py +0 -83
- snowflake/cli/plugins/sql/manager.py +0 -92
- snowflake/cli/plugins/sql/plugin_spec.py +0 -30
- snowflake/cli/plugins/sql/snowsql_templating.py +0 -28
- snowflake/cli/plugins/stage/__init__.py +0 -13
- snowflake/cli/plugins/stage/commands.py +0 -263
- snowflake/cli/plugins/stage/diff.py +0 -326
- snowflake/cli/plugins/stage/manager.py +0 -577
- snowflake/cli/plugins/stage/md5.py +0 -160
- snowflake/cli/plugins/stage/plugin_spec.py +0 -30
- snowflake/cli/plugins/streamlit/__init__.py +0 -13
- snowflake/cli/plugins/streamlit/commands.py +0 -179
- snowflake/cli/plugins/streamlit/manager.py +0 -222
- snowflake/cli/plugins/streamlit/plugin_spec.py +0 -30
- snowflake/cli/plugins/workspace/__init__.py +0 -13
- snowflake/cli/plugins/workspace/commands.py +0 -35
- snowflake/cli/plugins/workspace/plugin_spec.py +0 -30
- snowflake/cli/templates/default_snowpark/.gitignore +0 -4
- snowflake/cli/templates/default_snowpark/app/__init__.py +0 -0
- snowflake/cli/templates/default_snowpark/app/common.py +0 -2
- snowflake/cli/templates/default_snowpark/app/functions.py +0 -15
- snowflake/cli/templates/default_snowpark/app/procedures.py +0 -22
- snowflake/cli/templates/default_snowpark/requirements.txt +0 -1
- snowflake/cli/templates/default_snowpark/snowflake.yml +0 -23
- snowflake/cli/templates/default_streamlit/.gitignore +0 -4
- snowflake/cli/templates/default_streamlit/common/hello.py +0 -2
- snowflake/cli/templates/default_streamlit/environment.yml +0 -6
- snowflake/cli/templates/default_streamlit/pages/my_page.py +0 -3
- snowflake/cli/templates/default_streamlit/snowflake.yml +0 -10
- snowflake/cli/templates/default_streamlit/streamlit_app.py +0 -4
- snowflake_cli_labs-2.8.1.dist-info/RECORD +0 -240
- snowflake_cli_labs-2.8.1.dist-info/entry_points.txt +0 -2
- {snowflake_cli_labs-2.8.1.dist-info → snowflake_cli_labs-2.8.2.dist-info}/WHEEL +0 -0
- {snowflake_cli_labs-2.8.1.dist-info → snowflake_cli_labs-2.8.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,439 +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 logging
|
|
18
|
-
from pathlib import Path
|
|
19
|
-
from textwrap import dedent
|
|
20
|
-
from typing import List, Optional
|
|
21
|
-
|
|
22
|
-
import typer
|
|
23
|
-
from click import ClickException
|
|
24
|
-
from snowflake.cli.api.cli_global_context import cli_context
|
|
25
|
-
from snowflake.cli.api.commands.decorators import (
|
|
26
|
-
with_project_definition,
|
|
27
|
-
)
|
|
28
|
-
from snowflake.cli.api.commands.snow_typer import SnowTyperFactory
|
|
29
|
-
from snowflake.cli.api.output.formats import OutputFormat
|
|
30
|
-
from snowflake.cli.api.output.types import (
|
|
31
|
-
CollectionResult,
|
|
32
|
-
CommandResult,
|
|
33
|
-
MessageResult,
|
|
34
|
-
ObjectResult,
|
|
35
|
-
StreamResult,
|
|
36
|
-
)
|
|
37
|
-
from snowflake.cli.api.project.project_verification import assert_project_type
|
|
38
|
-
from snowflake.cli.api.secure_path import SecurePath
|
|
39
|
-
from snowflake.cli.plugins.nativeapp.common_flags import (
|
|
40
|
-
ForceOption,
|
|
41
|
-
InteractiveOption,
|
|
42
|
-
ValidateOption,
|
|
43
|
-
)
|
|
44
|
-
from snowflake.cli.plugins.nativeapp.init import (
|
|
45
|
-
OFFICIAL_TEMPLATES_GITHUB_URL,
|
|
46
|
-
nativeapp_init,
|
|
47
|
-
)
|
|
48
|
-
from snowflake.cli.plugins.nativeapp.manager import NativeAppManager
|
|
49
|
-
from snowflake.cli.plugins.nativeapp.policy import (
|
|
50
|
-
AllowAlwaysPolicy,
|
|
51
|
-
AskAlwaysPolicy,
|
|
52
|
-
DenyAlwaysPolicy,
|
|
53
|
-
)
|
|
54
|
-
from snowflake.cli.plugins.nativeapp.run_processor import NativeAppRunProcessor
|
|
55
|
-
from snowflake.cli.plugins.nativeapp.teardown_processor import (
|
|
56
|
-
NativeAppTeardownProcessor,
|
|
57
|
-
)
|
|
58
|
-
from snowflake.cli.plugins.nativeapp.utils import (
|
|
59
|
-
get_first_paragraph_from_markdown_file,
|
|
60
|
-
shallow_git_clone,
|
|
61
|
-
)
|
|
62
|
-
from snowflake.cli.plugins.nativeapp.v2_conversions.v2_to_v1_decorator import (
|
|
63
|
-
nativeapp_definition_v2_to_v1,
|
|
64
|
-
)
|
|
65
|
-
from snowflake.cli.plugins.nativeapp.version.commands import app as versions_app
|
|
66
|
-
from snowflake.cli.plugins.stage.diff import (
|
|
67
|
-
DiffResult,
|
|
68
|
-
compute_stage_diff,
|
|
69
|
-
print_diff_to_console,
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
app = SnowTyperFactory(
|
|
73
|
-
name="app",
|
|
74
|
-
help="Manages a Snowflake Native App",
|
|
75
|
-
)
|
|
76
|
-
app.add_typer(versions_app)
|
|
77
|
-
|
|
78
|
-
log = logging.getLogger(__name__)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
@app.command("init")
|
|
82
|
-
def app_init(
|
|
83
|
-
path: str = typer.Argument(
|
|
84
|
-
...,
|
|
85
|
-
help=f"""Directory to be initialized with the Snowflake Native App project. This directory must not already exist.""",
|
|
86
|
-
),
|
|
87
|
-
name: str = typer.Option(
|
|
88
|
-
None,
|
|
89
|
-
help=f"""The name of the Snowflake Native App project to include in snowflake.yml. When not specified, it is
|
|
90
|
-
generated from the name of the directory. Names are assumed to be unquoted identifiers whenever possible, but
|
|
91
|
-
can be forced to be quoted by including the surrounding quote characters in the provided value.""",
|
|
92
|
-
),
|
|
93
|
-
template_repo: str = typer.Option(
|
|
94
|
-
None,
|
|
95
|
-
help=f"""Specifies the git URL to a template repository, which can be a template itself or contain many templates inside it,
|
|
96
|
-
such as https://github.com/snowflakedb/native-apps-templates.git for all official Snowflake Native App with Snowflake CLI templates.
|
|
97
|
-
If using a private Github repo, you might be prompted to enter your Github username and password.
|
|
98
|
-
Please use your personal access token in the password prompt, and refer to
|
|
99
|
-
https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.""",
|
|
100
|
-
),
|
|
101
|
-
template: str = typer.Option(
|
|
102
|
-
None,
|
|
103
|
-
help="A specific template name within the template repo to use as template for the Snowflake Native App project. Example: Default is basic if `--template-repo` is https://github.com/snowflakedb/native-apps-templates.git, and None if any other --template-repo is specified.",
|
|
104
|
-
),
|
|
105
|
-
**options,
|
|
106
|
-
) -> CommandResult:
|
|
107
|
-
"""
|
|
108
|
-
Initializes a Snowflake Native App project.
|
|
109
|
-
"""
|
|
110
|
-
project = nativeapp_init(
|
|
111
|
-
path=path, name=name, git_url=template_repo, template=template
|
|
112
|
-
)
|
|
113
|
-
return MessageResult(
|
|
114
|
-
f"Snowflake Native App project {project.name} has been created at: {path}"
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
@app.command("list-templates", hidden=True)
|
|
119
|
-
def app_list_templates(**options) -> CommandResult:
|
|
120
|
-
"""
|
|
121
|
-
Prints information regarding the official templates that can be used with snow app init.
|
|
122
|
-
"""
|
|
123
|
-
with SecurePath.temporary_directory() as temp_path:
|
|
124
|
-
from git import rmtree as git_rmtree
|
|
125
|
-
|
|
126
|
-
repo = shallow_git_clone(OFFICIAL_TEMPLATES_GITHUB_URL, temp_path.path)
|
|
127
|
-
|
|
128
|
-
# Mark a directory as a template if a project definition jinja template is inside
|
|
129
|
-
template_directories = [
|
|
130
|
-
entry.name
|
|
131
|
-
for entry in repo.head.commit.tree
|
|
132
|
-
if (temp_path / entry.name / "snowflake.yml.jinja").exists()
|
|
133
|
-
]
|
|
134
|
-
|
|
135
|
-
# get the template descriptions from the README.md in its directory
|
|
136
|
-
template_descriptions = [
|
|
137
|
-
get_first_paragraph_from_markdown_file(
|
|
138
|
-
(temp_path / directory / "README.md").path
|
|
139
|
-
)
|
|
140
|
-
for directory in template_directories
|
|
141
|
-
]
|
|
142
|
-
|
|
143
|
-
result = (
|
|
144
|
-
{"template": directory, "description": description}
|
|
145
|
-
for directory, description in zip(
|
|
146
|
-
template_directories, template_descriptions
|
|
147
|
-
)
|
|
148
|
-
)
|
|
149
|
-
|
|
150
|
-
# proactively clean up here to avoid permission issues on Windows
|
|
151
|
-
repo.close()
|
|
152
|
-
git_rmtree(temp_path.path)
|
|
153
|
-
|
|
154
|
-
return CollectionResult(result)
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
@app.command("bundle")
|
|
158
|
-
@with_project_definition()
|
|
159
|
-
@nativeapp_definition_v2_to_v1
|
|
160
|
-
def app_bundle(
|
|
161
|
-
**options,
|
|
162
|
-
) -> CommandResult:
|
|
163
|
-
"""
|
|
164
|
-
Prepares a local folder with configured app artifacts.
|
|
165
|
-
"""
|
|
166
|
-
|
|
167
|
-
assert_project_type("native_app")
|
|
168
|
-
|
|
169
|
-
manager = NativeAppManager(
|
|
170
|
-
project_definition=cli_context.project_definition.native_app,
|
|
171
|
-
project_root=cli_context.project_root,
|
|
172
|
-
)
|
|
173
|
-
manager.build_bundle()
|
|
174
|
-
return MessageResult(f"Bundle generated at {manager.deploy_root}")
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
@app.command("diff", requires_connection=True, hidden=True)
|
|
178
|
-
@with_project_definition()
|
|
179
|
-
@nativeapp_definition_v2_to_v1
|
|
180
|
-
def app_diff(
|
|
181
|
-
**options,
|
|
182
|
-
) -> CommandResult:
|
|
183
|
-
"""
|
|
184
|
-
Performs a diff between the app's source stage and the local deploy root.
|
|
185
|
-
"""
|
|
186
|
-
assert_project_type("native_app")
|
|
187
|
-
|
|
188
|
-
manager = NativeAppManager(
|
|
189
|
-
project_definition=cli_context.project_definition.native_app,
|
|
190
|
-
project_root=cli_context.project_root,
|
|
191
|
-
)
|
|
192
|
-
bundle_map = manager.build_bundle()
|
|
193
|
-
diff: DiffResult = compute_stage_diff(
|
|
194
|
-
local_root=Path(manager.deploy_root), stage_fqn=manager.stage_fqn
|
|
195
|
-
)
|
|
196
|
-
if cli_context.output_format == OutputFormat.JSON:
|
|
197
|
-
return ObjectResult(diff.to_dict())
|
|
198
|
-
else:
|
|
199
|
-
print_diff_to_console(diff, bundle_map)
|
|
200
|
-
return None # don't print any output
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
@app.command("run", requires_connection=True)
|
|
204
|
-
@with_project_definition()
|
|
205
|
-
@nativeapp_definition_v2_to_v1
|
|
206
|
-
def app_run(
|
|
207
|
-
version: Optional[str] = typer.Option(
|
|
208
|
-
None,
|
|
209
|
-
help=f"""The version defined in an existing application package from which you want to create an application object.
|
|
210
|
-
The application object and application package names are determined from the project definition file.""",
|
|
211
|
-
),
|
|
212
|
-
patch: Optional[int] = typer.Option(
|
|
213
|
-
None,
|
|
214
|
-
"--patch",
|
|
215
|
-
help=f"""The patch number under the given `--version` defined in an existing application package that should be used to create an application object.
|
|
216
|
-
The application object and application package names are determined from the project definition file.""",
|
|
217
|
-
),
|
|
218
|
-
from_release_directive: Optional[bool] = typer.Option(
|
|
219
|
-
False,
|
|
220
|
-
"--from-release-directive",
|
|
221
|
-
help=f"""Creates or upgrades an application object to the version and patch specified by the release directive applicable to your Snowflake account.
|
|
222
|
-
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.""",
|
|
223
|
-
is_flag=True,
|
|
224
|
-
),
|
|
225
|
-
interactive: bool = InteractiveOption,
|
|
226
|
-
force: Optional[bool] = ForceOption,
|
|
227
|
-
validate: bool = ValidateOption,
|
|
228
|
-
**options,
|
|
229
|
-
) -> CommandResult:
|
|
230
|
-
"""
|
|
231
|
-
Creates an application package in your Snowflake account, uploads code files to its stage,
|
|
232
|
-
then creates or upgrades an application object from the application package.
|
|
233
|
-
"""
|
|
234
|
-
|
|
235
|
-
assert_project_type("native_app")
|
|
236
|
-
|
|
237
|
-
is_interactive = False
|
|
238
|
-
if force:
|
|
239
|
-
policy = AllowAlwaysPolicy()
|
|
240
|
-
elif interactive:
|
|
241
|
-
is_interactive = True
|
|
242
|
-
policy = AskAlwaysPolicy()
|
|
243
|
-
else:
|
|
244
|
-
policy = DenyAlwaysPolicy()
|
|
245
|
-
|
|
246
|
-
processor = NativeAppRunProcessor(
|
|
247
|
-
project_definition=cli_context.project_definition.native_app,
|
|
248
|
-
project_root=cli_context.project_root,
|
|
249
|
-
)
|
|
250
|
-
bundle_map = processor.build_bundle()
|
|
251
|
-
processor.process(
|
|
252
|
-
bundle_map=bundle_map,
|
|
253
|
-
policy=policy,
|
|
254
|
-
version=version,
|
|
255
|
-
patch=patch,
|
|
256
|
-
from_release_directive=from_release_directive,
|
|
257
|
-
is_interactive=is_interactive,
|
|
258
|
-
validate=validate,
|
|
259
|
-
)
|
|
260
|
-
return MessageResult(
|
|
261
|
-
f"Your application object ({processor.app_name}) is now available:\n"
|
|
262
|
-
+ processor.get_snowsight_url()
|
|
263
|
-
)
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
@app.command("open", requires_connection=True)
|
|
267
|
-
@with_project_definition()
|
|
268
|
-
@nativeapp_definition_v2_to_v1
|
|
269
|
-
def app_open(
|
|
270
|
-
**options,
|
|
271
|
-
) -> CommandResult:
|
|
272
|
-
"""
|
|
273
|
-
Opens the Snowflake Native App inside of your browser,
|
|
274
|
-
once it has been installed in your account.
|
|
275
|
-
"""
|
|
276
|
-
|
|
277
|
-
assert_project_type("native_app")
|
|
278
|
-
|
|
279
|
-
manager = NativeAppManager(
|
|
280
|
-
project_definition=cli_context.project_definition.native_app,
|
|
281
|
-
project_root=cli_context.project_root,
|
|
282
|
-
)
|
|
283
|
-
if manager.get_existing_app_info():
|
|
284
|
-
typer.launch(manager.get_snowsight_url())
|
|
285
|
-
return MessageResult(f"Snowflake Native App opened in browser.")
|
|
286
|
-
else:
|
|
287
|
-
return MessageResult(
|
|
288
|
-
'Snowflake Native App not yet deployed! Please run "snow app run" first.'
|
|
289
|
-
)
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
@app.command("teardown", requires_connection=True)
|
|
293
|
-
@with_project_definition()
|
|
294
|
-
@nativeapp_definition_v2_to_v1
|
|
295
|
-
def app_teardown(
|
|
296
|
-
force: Optional[bool] = ForceOption,
|
|
297
|
-
cascade: Optional[bool] = typer.Option(
|
|
298
|
-
None,
|
|
299
|
-
help=f"""Whether to drop all application objects owned by the application within the account. Default: false.""",
|
|
300
|
-
show_default=False,
|
|
301
|
-
),
|
|
302
|
-
interactive: bool = InteractiveOption,
|
|
303
|
-
**options,
|
|
304
|
-
) -> CommandResult:
|
|
305
|
-
"""
|
|
306
|
-
Attempts to drop both the application object and application package as defined in the project definition file.
|
|
307
|
-
"""
|
|
308
|
-
|
|
309
|
-
assert_project_type("native_app")
|
|
310
|
-
|
|
311
|
-
processor = NativeAppTeardownProcessor(
|
|
312
|
-
project_definition=cli_context.project_definition.native_app,
|
|
313
|
-
project_root=cli_context.project_root,
|
|
314
|
-
)
|
|
315
|
-
processor.process(interactive, force, cascade)
|
|
316
|
-
return MessageResult(f"Teardown is now complete.")
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
@app.command("deploy", requires_connection=True)
|
|
320
|
-
@with_project_definition()
|
|
321
|
-
@nativeapp_definition_v2_to_v1
|
|
322
|
-
def app_deploy(
|
|
323
|
-
prune: Optional[bool] = typer.Option(
|
|
324
|
-
default=None,
|
|
325
|
-
help=f"""Whether to delete specified files from the stage if they don't exist locally. If set, the command deletes files that exist in the stage, but not in the local filesystem. This option cannot be used when paths are specified.""",
|
|
326
|
-
),
|
|
327
|
-
recursive: Optional[bool] = typer.Option(
|
|
328
|
-
None,
|
|
329
|
-
"--recursive/--no-recursive",
|
|
330
|
-
"-r",
|
|
331
|
-
help=f"""Whether to traverse and deploy files from subdirectories. If set, the command deploys all files and subdirectories; otherwise, only files in the current directory are deployed.""",
|
|
332
|
-
),
|
|
333
|
-
paths: Optional[List[Path]] = typer.Argument(
|
|
334
|
-
default=None,
|
|
335
|
-
show_default=False,
|
|
336
|
-
help=dedent(
|
|
337
|
-
f"""
|
|
338
|
-
Paths, relative to the the project root, of files or directories you want to upload to a stage. If a file is
|
|
339
|
-
specified, it must match one of the artifacts src pattern entries in snowflake.yml. If a directory is
|
|
340
|
-
specified, it will be searched for subfolders or files to deploy based on artifacts src pattern entries. If
|
|
341
|
-
unspecified, the command syncs all local changes to the stage."""
|
|
342
|
-
).strip(),
|
|
343
|
-
),
|
|
344
|
-
validate: bool = ValidateOption,
|
|
345
|
-
**options,
|
|
346
|
-
) -> CommandResult:
|
|
347
|
-
"""
|
|
348
|
-
Creates an application package in your Snowflake account and syncs the local changes to the stage without creating or updating the application.
|
|
349
|
-
Running this command with no arguments at all, as in `snow app deploy`, is a shorthand for `snow app deploy --prune --recursive`.
|
|
350
|
-
"""
|
|
351
|
-
|
|
352
|
-
assert_project_type("native_app")
|
|
353
|
-
|
|
354
|
-
has_paths = paths is not None and len(paths) > 0
|
|
355
|
-
if prune is None and recursive is None and not has_paths:
|
|
356
|
-
prune = True
|
|
357
|
-
recursive = True
|
|
358
|
-
else:
|
|
359
|
-
if prune is None:
|
|
360
|
-
prune = False
|
|
361
|
-
if recursive is None:
|
|
362
|
-
recursive = False
|
|
363
|
-
|
|
364
|
-
if has_paths and prune:
|
|
365
|
-
raise ClickException("--prune cannot be used when paths are also specified")
|
|
366
|
-
|
|
367
|
-
manager = NativeAppManager(
|
|
368
|
-
project_definition=cli_context.project_definition.native_app,
|
|
369
|
-
project_root=cli_context.project_root,
|
|
370
|
-
)
|
|
371
|
-
|
|
372
|
-
bundle_map = manager.build_bundle()
|
|
373
|
-
manager.deploy(
|
|
374
|
-
bundle_map=bundle_map,
|
|
375
|
-
prune=prune,
|
|
376
|
-
recursive=recursive,
|
|
377
|
-
local_paths_to_sync=paths,
|
|
378
|
-
validate=validate,
|
|
379
|
-
)
|
|
380
|
-
|
|
381
|
-
return MessageResult(
|
|
382
|
-
f"Deployed successfully. Application package and stage are up-to-date."
|
|
383
|
-
)
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
@app.command("validate", requires_connection=True)
|
|
387
|
-
@with_project_definition()
|
|
388
|
-
@nativeapp_definition_v2_to_v1
|
|
389
|
-
def app_validate(**options):
|
|
390
|
-
"""
|
|
391
|
-
Validates a deployed Snowflake Native App's setup script.
|
|
392
|
-
"""
|
|
393
|
-
|
|
394
|
-
assert_project_type("native_app")
|
|
395
|
-
|
|
396
|
-
manager = NativeAppManager(
|
|
397
|
-
project_definition=cli_context.project_definition.native_app,
|
|
398
|
-
project_root=cli_context.project_root,
|
|
399
|
-
)
|
|
400
|
-
if cli_context.output_format == OutputFormat.JSON:
|
|
401
|
-
return ObjectResult(manager.get_validation_result(use_scratch_stage=True))
|
|
402
|
-
|
|
403
|
-
manager.validate(use_scratch_stage=True)
|
|
404
|
-
return MessageResult("Snowflake Native App validation succeeded.")
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
@app.command("events", hidden=True, requires_connection=True)
|
|
408
|
-
@with_project_definition()
|
|
409
|
-
@nativeapp_definition_v2_to_v1
|
|
410
|
-
def app_events(**options):
|
|
411
|
-
"""Fetches events for this app from the event table configured in Snowflake."""
|
|
412
|
-
assert_project_type("native_app")
|
|
413
|
-
|
|
414
|
-
manager = NativeAppManager(
|
|
415
|
-
project_definition=cli_context.project_definition.native_app,
|
|
416
|
-
project_root=cli_context.project_root,
|
|
417
|
-
)
|
|
418
|
-
events = manager.get_events()
|
|
419
|
-
if not events:
|
|
420
|
-
return MessageResult("No events found.")
|
|
421
|
-
|
|
422
|
-
def g():
|
|
423
|
-
for event in events:
|
|
424
|
-
yield EventResult(event)
|
|
425
|
-
|
|
426
|
-
return StreamResult(g())
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
class EventResult(ObjectResult, MessageResult):
|
|
430
|
-
"""ObjectResult that renders as a custom string when not printed as JSON."""
|
|
431
|
-
|
|
432
|
-
@property
|
|
433
|
-
def message(self):
|
|
434
|
-
e = self._element
|
|
435
|
-
return f"{e['TIMESTAMP']} {e['VALUE']}"
|
|
436
|
-
|
|
437
|
-
@property
|
|
438
|
-
def result(self):
|
|
439
|
-
return self._element
|
|
@@ -1,44 +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
|
-
import typer
|
|
16
|
-
from snowflake.cli.plugins.nativeapp.utils import is_tty_interactive
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def interactive_callback(val):
|
|
20
|
-
if val is None:
|
|
21
|
-
return is_tty_interactive()
|
|
22
|
-
return val
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
InteractiveOption = typer.Option(
|
|
26
|
-
None,
|
|
27
|
-
help=f"""When enabled, this option displays prompts even if the standard input and output are not terminal devices. Defaults to True in an interactive shell environment, and False otherwise.""",
|
|
28
|
-
callback=interactive_callback,
|
|
29
|
-
show_default=False,
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
ForceOption = typer.Option(
|
|
33
|
-
False,
|
|
34
|
-
"--force",
|
|
35
|
-
help=f"""When enabled, this option causes the command to implicitly approve any prompts that arise.
|
|
36
|
-
You should enable this option if interactive mode is not specified and if you want perform potentially destructive actions. Defaults to unset.""",
|
|
37
|
-
is_flag=True,
|
|
38
|
-
)
|
|
39
|
-
ValidateOption = typer.Option(
|
|
40
|
-
True,
|
|
41
|
-
"--validate/--no-validate",
|
|
42
|
-
help="""When enabled, this option triggers validation of a deployed Snowflake Native App's setup script SQL""",
|
|
43
|
-
is_flag=True,
|
|
44
|
-
)
|
|
@@ -1,27 +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
|
-
SPECIAL_COMMENT_OLD = "GENERATED_BY_SNOWCLI"
|
|
16
|
-
SPECIAL_COMMENT = "GENERATED_BY_SNOWFLAKECLI"
|
|
17
|
-
ALLOWED_SPECIAL_COMMENTS = {SPECIAL_COMMENT, SPECIAL_COMMENT_OLD}
|
|
18
|
-
LOOSE_FILES_MAGIC_VERSION = "UNVERSIONED"
|
|
19
|
-
|
|
20
|
-
NAME_COL = "name"
|
|
21
|
-
COMMENT_COL = "comment"
|
|
22
|
-
OWNER_COL = "owner"
|
|
23
|
-
VERSION_COL = "version"
|
|
24
|
-
PATCH_COL = "patch"
|
|
25
|
-
|
|
26
|
-
INTERNAL_DISTRIBUTION = "internal"
|
|
27
|
-
EXTERNAL_DISTRIBUTION = "external"
|
|
@@ -1,122 +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 textwrap import dedent
|
|
18
|
-
from typing import Optional
|
|
19
|
-
|
|
20
|
-
import jinja2
|
|
21
|
-
from click.exceptions import ClickException
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class ApplicationPackageAlreadyExistsError(ClickException):
|
|
25
|
-
"""An application package not created by Snowflake CLI exists with the same name."""
|
|
26
|
-
|
|
27
|
-
def __init__(self, name: str):
|
|
28
|
-
super().__init__(
|
|
29
|
-
f"An Application Package {name} already exists in account that may have been created without Snowflake CLI."
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class ApplicationPackageDoesNotExistError(ClickException):
|
|
34
|
-
"""An application package of the specified name does not exist in the Snowflake account or the current role isn't authorized."""
|
|
35
|
-
|
|
36
|
-
def __init__(self, name: str):
|
|
37
|
-
super().__init__(
|
|
38
|
-
f"Application Package {name} does not exist in the Snowflake account or not authorized."
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
class ApplicationCreatedExternallyError(ClickException):
|
|
43
|
-
"""An application object not created by Snowflake CLI exists with the same name."""
|
|
44
|
-
|
|
45
|
-
def __init__(self, name: str):
|
|
46
|
-
super().__init__(
|
|
47
|
-
f'An application object "{name}" not created by Snowflake CLI already exists in the account.'
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
class UnexpectedOwnerError(ClickException):
|
|
52
|
-
"""An operation is blocked because an object is owned by an unexpected role."""
|
|
53
|
-
|
|
54
|
-
def __init__(self, item: str, expected_owner: str, actual_owner: str):
|
|
55
|
-
super().__init__(
|
|
56
|
-
f"Cannot operate on {item}: owned by {actual_owner} (expected {expected_owner})"
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
class MissingScriptError(ClickException):
|
|
61
|
-
"""A referenced script was not found."""
|
|
62
|
-
|
|
63
|
-
def __init__(self, relpath: str):
|
|
64
|
-
super().__init__(f'Script "{relpath}" does not exist')
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
class InvalidScriptError(ClickException):
|
|
68
|
-
"""A referenced script had syntax error(s)."""
|
|
69
|
-
|
|
70
|
-
def __init__(
|
|
71
|
-
self, relpath: str, err: jinja2.TemplateError, lineno: Optional[int] = None
|
|
72
|
-
):
|
|
73
|
-
lineno_str = f":{lineno}" if lineno is not None else ""
|
|
74
|
-
super().__init__(
|
|
75
|
-
f'Script "{relpath}{lineno_str}" does not contain a valid template: {err.message}'
|
|
76
|
-
)
|
|
77
|
-
self.err = err
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
class MissingSchemaError(ClickException):
|
|
81
|
-
"""An identifier is missing a schema qualifier."""
|
|
82
|
-
|
|
83
|
-
def __init__(self, identifier: str):
|
|
84
|
-
super().__init__(f'Identifier missing a schema qualifier: "{identifier}"')
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
class CouldNotDropApplicationPackageWithVersions(ClickException):
|
|
88
|
-
"""Application package could not be dropped as it has versions associated with it."""
|
|
89
|
-
|
|
90
|
-
def __init__(self, additional_msg: str = ""):
|
|
91
|
-
super().__init__(
|
|
92
|
-
dedent(
|
|
93
|
-
f"""
|
|
94
|
-
{self.__doc__}
|
|
95
|
-
{additional_msg}
|
|
96
|
-
"""
|
|
97
|
-
).strip()
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
class SetupScriptFailedValidation(ClickException):
|
|
102
|
-
"""Snowflake Native App setup script failed validation."""
|
|
103
|
-
|
|
104
|
-
def __init__(self):
|
|
105
|
-
super().__init__(self.__doc__)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
class NoEventTableForAccount(ClickException):
|
|
109
|
-
"""No event table was found for this Snowflake account."""
|
|
110
|
-
|
|
111
|
-
INSTRUCTIONS = dedent(
|
|
112
|
-
"""\
|
|
113
|
-
Ask your Snowflake administrator to set up an event table for your account by following the docs at
|
|
114
|
-
https://docs.snowflake.com/en/developer-guide/logging-tracing/event-table-setting-up.
|
|
115
|
-
|
|
116
|
-
If your account is configured to send events to an organization event account, create a new
|
|
117
|
-
connection to this account using `snow connection add` and re-run this command using the new connection.
|
|
118
|
-
More information on event accounts is available at https://docs.snowflake.com/en/developer-guide/native-apps/setting-up-logging-and-events#configure-an-account-to-store-shared-events."""
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
def __init__(self):
|
|
122
|
-
super().__init__(f"{self.__doc__}\n\n{self.INSTRUCTIONS}")
|
|
@@ -1,24 +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 enum import unique
|
|
16
|
-
|
|
17
|
-
from snowflake.cli.api.feature_flags import BooleanFlag, FeatureFlagMixin
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@unique
|
|
21
|
-
class FeatureFlag(FeatureFlagMixin):
|
|
22
|
-
ENABLE_NATIVE_APP_PYTHON_SETUP = BooleanFlag(
|
|
23
|
-
"ENABLE_NATIVE_APP_PYTHON_SETUP", False
|
|
24
|
-
)
|