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
snowflake/cli/api/console/abc.py
DELETED
|
@@ -1,89 +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 abc import ABC, abstractmethod
|
|
18
|
-
from contextlib import contextmanager
|
|
19
|
-
from typing import Callable, Iterator, Optional
|
|
20
|
-
|
|
21
|
-
from rich import print as rich_print
|
|
22
|
-
from rich.text import Text
|
|
23
|
-
from snowflake.cli.api.cli_global_context import _CliGlobalContextAccess, cli_context
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class AbstractConsole(ABC):
|
|
27
|
-
"""Interface for cli console implementation.
|
|
28
|
-
|
|
29
|
-
Each console should have three methods implemented:
|
|
30
|
-
- `step` - for more detailed information on steps
|
|
31
|
-
- `warning` - for displaying messages in a style that makes it
|
|
32
|
-
visually stand out from other output
|
|
33
|
-
- `phase` a context manager for organising steps into logical group
|
|
34
|
-
"""
|
|
35
|
-
|
|
36
|
-
_print_fn: Callable[[str], None]
|
|
37
|
-
_cli_context: _CliGlobalContextAccess
|
|
38
|
-
_in_phase: bool
|
|
39
|
-
|
|
40
|
-
def __init__(self):
|
|
41
|
-
super().__init__()
|
|
42
|
-
self._cli_context = cli_context
|
|
43
|
-
self._in_phase = False
|
|
44
|
-
|
|
45
|
-
@property
|
|
46
|
-
def is_silent(self) -> bool:
|
|
47
|
-
"""Returns information whether intermediate output is muted."""
|
|
48
|
-
return self._cli_context.silent
|
|
49
|
-
|
|
50
|
-
@property
|
|
51
|
-
def in_phase(self) -> bool:
|
|
52
|
-
"""Indicated whether output should be grouped."""
|
|
53
|
-
return self._in_phase
|
|
54
|
-
|
|
55
|
-
def _print(self, text: Text):
|
|
56
|
-
if self.is_silent:
|
|
57
|
-
return
|
|
58
|
-
rich_print(text)
|
|
59
|
-
|
|
60
|
-
@contextmanager
|
|
61
|
-
@abstractmethod
|
|
62
|
-
def phase(
|
|
63
|
-
self,
|
|
64
|
-
enter_message: str,
|
|
65
|
-
exit_message: Optional[str] = None,
|
|
66
|
-
) -> Iterator[Callable[[str], None]]:
|
|
67
|
-
"""A context manager for organising steps into logical group."""
|
|
68
|
-
|
|
69
|
-
@contextmanager
|
|
70
|
-
@abstractmethod
|
|
71
|
-
def indented(self):
|
|
72
|
-
"""
|
|
73
|
-
A context manager for temporarily indenting messages and warnings. Phases and steps cannot be used in indented blocks,
|
|
74
|
-
but multiple indented blocks can be nested (use sparingly).
|
|
75
|
-
"""
|
|
76
|
-
|
|
77
|
-
@abstractmethod
|
|
78
|
-
def step(self, message: str):
|
|
79
|
-
"""Displays a message to output."""
|
|
80
|
-
|
|
81
|
-
@abstractmethod
|
|
82
|
-
def message(self, _message: str):
|
|
83
|
-
"""Displays an informational message to output."""
|
|
84
|
-
|
|
85
|
-
@abstractmethod
|
|
86
|
-
def warning(self, message: str):
|
|
87
|
-
"""Displays message in a style that makes it visually stand out from other output.
|
|
88
|
-
|
|
89
|
-
Intended for displaying messages related to important messages."""
|
|
@@ -1,134 +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 contextlib import contextmanager
|
|
18
|
-
from typing import Optional
|
|
19
|
-
|
|
20
|
-
from rich.style import Style
|
|
21
|
-
from rich.text import Text
|
|
22
|
-
from snowflake.cli.api.console.abc import AbstractConsole
|
|
23
|
-
from snowflake.cli.api.console.enum import Output
|
|
24
|
-
|
|
25
|
-
PHASE_STYLE: Style = Style(bold=True)
|
|
26
|
-
STEP_STYLE: Style = Style(italic=True)
|
|
27
|
-
INFO_STYLE: Style = Style()
|
|
28
|
-
IMPORTANT_STYLE: Style = Style(bold=True, italic=True)
|
|
29
|
-
INDENTATION_LEVEL: int = 2
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
class CliConsoleNestingProhibitedError(RuntimeError):
|
|
33
|
-
"""CliConsole phase nesting not allowed."""
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
class CliConsole(AbstractConsole):
|
|
37
|
-
"""An utility for displaying intermediate output.
|
|
38
|
-
|
|
39
|
-
Provides following methods for handling displaying messages:
|
|
40
|
-
- `step` - for more detailed information on steps
|
|
41
|
-
- `warning` - for displaying messages in a style that makes it
|
|
42
|
-
visually stand out from other output
|
|
43
|
-
- `phase` a context manager for organising steps into logical group
|
|
44
|
-
"""
|
|
45
|
-
|
|
46
|
-
_indentation_level: int = INDENTATION_LEVEL
|
|
47
|
-
_extra_indent: int = 0
|
|
48
|
-
_styles: dict = {
|
|
49
|
-
"default": "",
|
|
50
|
-
Output.PHASE: PHASE_STYLE,
|
|
51
|
-
Output.STEP: STEP_STYLE,
|
|
52
|
-
Output.INFO: None,
|
|
53
|
-
Output.IMPORTANT: IMPORTANT_STYLE,
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
def _format_message(self, message: str, output: Output) -> Text:
|
|
57
|
-
"""Wraps message in rich Text object and applies formatting."""
|
|
58
|
-
style = self._styles.get(output, "default")
|
|
59
|
-
if style is not None:
|
|
60
|
-
text = Text(message, style=style)
|
|
61
|
-
else:
|
|
62
|
-
text = Text.from_markup(message)
|
|
63
|
-
|
|
64
|
-
current_indent = self._extra_indent
|
|
65
|
-
if self.in_phase and output in {Output.STEP, Output.INFO, Output.IMPORTANT}:
|
|
66
|
-
current_indent += 1
|
|
67
|
-
text.pad_left(current_indent * self._indentation_level)
|
|
68
|
-
return text
|
|
69
|
-
|
|
70
|
-
@contextmanager
|
|
71
|
-
def phase(self, enter_message: str, exit_message: Optional[str] = None):
|
|
72
|
-
"""A context manager for organising steps into logical group."""
|
|
73
|
-
if self.in_phase:
|
|
74
|
-
raise CliConsoleNestingProhibitedError("Only one phase allowed at a time.")
|
|
75
|
-
if self._extra_indent > 0:
|
|
76
|
-
raise CliConsoleNestingProhibitedError(
|
|
77
|
-
"Phase cannot be used in an indented block."
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
self._print(self._format_message(enter_message, Output.PHASE))
|
|
81
|
-
self._in_phase = True
|
|
82
|
-
|
|
83
|
-
try:
|
|
84
|
-
yield self.step
|
|
85
|
-
finally:
|
|
86
|
-
self._in_phase = False
|
|
87
|
-
if exit_message:
|
|
88
|
-
self._print(self._format_message(exit_message, Output.PHASE))
|
|
89
|
-
|
|
90
|
-
@contextmanager
|
|
91
|
-
def indented(self):
|
|
92
|
-
"""
|
|
93
|
-
A context manager for temporarily indenting messages and warnings. Phases and steps cannot be used in indented blocks,
|
|
94
|
-
but multiple indented blocks can be nested (use sparingly).
|
|
95
|
-
"""
|
|
96
|
-
self._extra_indent += 1
|
|
97
|
-
try:
|
|
98
|
-
yield
|
|
99
|
-
finally:
|
|
100
|
-
self._extra_indent -= 1
|
|
101
|
-
|
|
102
|
-
def step(self, message: str):
|
|
103
|
-
"""Displays a message to output.
|
|
104
|
-
|
|
105
|
-
If called within a phase, the output will be indented.
|
|
106
|
-
"""
|
|
107
|
-
if self._extra_indent > 0:
|
|
108
|
-
raise CliConsoleNestingProhibitedError(
|
|
109
|
-
"Step cannot be used in an indented block."
|
|
110
|
-
)
|
|
111
|
-
text = self._format_message(message, Output.STEP)
|
|
112
|
-
self._print(text)
|
|
113
|
-
|
|
114
|
-
def message(self, _message: str):
|
|
115
|
-
"""Displays an informational message to output.
|
|
116
|
-
|
|
117
|
-
If called within a phase, the output will be indented."""
|
|
118
|
-
text = self._format_message(_message, Output.INFO)
|
|
119
|
-
self._print(text)
|
|
120
|
-
|
|
121
|
-
def warning(self, message: str):
|
|
122
|
-
"""Displays message in a style that makes it visually stand out from other output.
|
|
123
|
-
|
|
124
|
-
This should be used to display important messages to the console."""
|
|
125
|
-
text = self._format_message(message, Output.IMPORTANT)
|
|
126
|
-
self._print(text)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
def get_cli_console() -> AbstractConsole:
|
|
130
|
-
console = CliConsole()
|
|
131
|
-
return console
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
cli_console = get_cli_console()
|
|
@@ -1,17 +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 Enum
|
|
16
|
-
|
|
17
|
-
Output = Enum("Output", ("PHASE", "STEP", "INFO", "IMPORTANT"))
|
snowflake/cli/api/constants.py
DELETED
|
@@ -1,79 +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 dataclasses import dataclass
|
|
18
|
-
from enum import Enum
|
|
19
|
-
from pathlib import Path
|
|
20
|
-
|
|
21
|
-
TEMPLATES_PATH = Path(__file__).parent.parent / "templates"
|
|
22
|
-
DEPLOYMENT_STAGE = "deployments"
|
|
23
|
-
PYTHON_3_12 = (3, 12)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
@dataclass(frozen=True)
|
|
27
|
-
class ObjectNames:
|
|
28
|
-
cli_name: str
|
|
29
|
-
sf_name: str
|
|
30
|
-
sf_plural_name: str
|
|
31
|
-
|
|
32
|
-
def __str__(self):
|
|
33
|
-
return self.sf_name
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
class ObjectType(Enum):
|
|
37
|
-
COMPUTE_POOL = ObjectNames("compute-pool", "compute pool", "compute pools")
|
|
38
|
-
DATABASE = ObjectNames("database", "database", "databases")
|
|
39
|
-
FUNCTION = ObjectNames("function", "function", "functions")
|
|
40
|
-
INTEGRATION = ObjectNames("integration", "integration", "integrations")
|
|
41
|
-
EXTERNAL_ACCESS_INTEGRATION = ObjectNames(
|
|
42
|
-
"external-access-integration",
|
|
43
|
-
"external access integration",
|
|
44
|
-
"external access integrations",
|
|
45
|
-
)
|
|
46
|
-
# JOB = ObjectNames("job", "job", "jobs")
|
|
47
|
-
NETWORK_RULE = ObjectNames("network-rule", "network rule", "network rules")
|
|
48
|
-
PROCEDURE = ObjectNames("procedure", "procedure", "procedures")
|
|
49
|
-
ROLE = ObjectNames("role", "role", "roles")
|
|
50
|
-
SCHEMA = ObjectNames("schema", "schema", "schemas")
|
|
51
|
-
SERVICE = ObjectNames("service", "service", "services")
|
|
52
|
-
SECRET = ObjectNames("secret", "secret", "secrets")
|
|
53
|
-
STAGE = ObjectNames("stage", "stage", "stages")
|
|
54
|
-
STREAM = ObjectNames("stream", "stream", "streams")
|
|
55
|
-
STREAMLIT = ObjectNames("streamlit", "streamlit", "streamlits")
|
|
56
|
-
TABLE = ObjectNames("table", "table", "tables")
|
|
57
|
-
TASK = ObjectNames("task", "task", "tasks")
|
|
58
|
-
USER = ObjectNames("user", "user", "users")
|
|
59
|
-
WAREHOUSE = ObjectNames("warehouse", "warehouse", "warehouses")
|
|
60
|
-
VIEW = ObjectNames("view", "view", "views")
|
|
61
|
-
IMAGE_REPOSITORY = ObjectNames(
|
|
62
|
-
"image-repository", "image repository", "image repositories"
|
|
63
|
-
)
|
|
64
|
-
GIT_REPOSITORY = ObjectNames("git-repository", "git repository", "git repositories")
|
|
65
|
-
|
|
66
|
-
def __str__(self):
|
|
67
|
-
"""This makes using this Enum easier in formatted string"""
|
|
68
|
-
return self.value.cli_name
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
OBJECT_TO_NAMES = {o.value.cli_name: o.value for o in ObjectType}
|
|
72
|
-
SUPPORTED_OBJECTS = sorted(OBJECT_TO_NAMES.keys())
|
|
73
|
-
|
|
74
|
-
# Scope names here must replace spaces with '-'. For example 'compute pool' is 'compute-pool'.
|
|
75
|
-
VALID_SCOPES = ["database", "schema", "compute-pool"]
|
|
76
|
-
|
|
77
|
-
DEFAULT_SIZE_LIMIT_MB = 128
|
|
78
|
-
|
|
79
|
-
SF_REST_API_URL_PREFIX = "/api/v2"
|
snowflake/cli/api/errno.py
DELETED
|
@@ -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
|
-
# General errors
|
|
16
|
-
NO_WAREHOUSE_SELECTED_IN_SESSION = 606
|
|
17
|
-
|
|
18
|
-
DOES_NOT_EXIST_OR_NOT_AUTHORIZED = 2003
|
|
19
|
-
DOES_NOT_EXIST_OR_CANNOT_BE_PERFORMED = 2043
|
|
20
|
-
|
|
21
|
-
# Native Apps
|
|
22
|
-
CANNOT_UPGRADE_FROM_LOOSE_FILES_TO_VERSION = 93044
|
|
23
|
-
CANNOT_UPGRADE_FROM_VERSION_TO_LOOSE_FILES = 93045
|
|
24
|
-
ONLY_SUPPORTED_ON_DEV_MODE_APPLICATIONS = 93046
|
|
25
|
-
NOT_SUPPORTED_ON_DEV_MODE_APPLICATIONS = 93055
|
|
26
|
-
APPLICATION_NO_LONGER_AVAILABLE = 93079
|
|
27
|
-
APPLICATION_OWNS_EXTERNAL_OBJECTS = 93128
|
snowflake/cli/api/exceptions.py
DELETED
|
@@ -1,164 +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 Optional
|
|
19
|
-
|
|
20
|
-
from click.exceptions import ClickException
|
|
21
|
-
from snowflake.cli.api.constants import ObjectType
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class EnvironmentVariableNotFoundError(ClickException):
|
|
25
|
-
def __init__(self, env_variable_name: str):
|
|
26
|
-
super().__init__(f"Environment variable {env_variable_name} not found")
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class MissingConfiguration(ClickException):
|
|
30
|
-
pass
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class CycleDetectedError(ClickException):
|
|
34
|
-
pass
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
class InvalidTemplate(ClickException):
|
|
38
|
-
pass
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
class InvalidConnectionConfiguration(ClickException):
|
|
42
|
-
def format_message(self):
|
|
43
|
-
return f"Invalid connection configuration. {self.message}"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
class InvalidLogsConfiguration(ClickException):
|
|
47
|
-
def format_message(self):
|
|
48
|
-
return f"Invalid logs configuration. {self.message}"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
class InvalidPluginConfiguration(ClickException):
|
|
52
|
-
def format_message(self):
|
|
53
|
-
return f"Invalid plugin configuration. {self.message}"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
class SnowflakeConnectionError(ClickException):
|
|
57
|
-
def __init__(self, snowflake_err: Exception):
|
|
58
|
-
super().__init__(f"Could not connect to Snowflake. Reason: {snowflake_err}")
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
class UnsupportedConfigSectionTypeError(Exception):
|
|
62
|
-
def __init__(self, section_type: type):
|
|
63
|
-
super().__init__(f"Unsupported configuration section type {section_type}")
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
class OutputDataTypeError(ClickException):
|
|
67
|
-
def __init__(self, got_type: type, expected_type: type):
|
|
68
|
-
super().__init__(f"Got {got_type} type but expected {expected_type}")
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
class CommandReturnTypeError(ClickException):
|
|
72
|
-
def __init__(self, got_type: type):
|
|
73
|
-
super().__init__(f"Commands have to return OutputData type, but got {got_type}")
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
class SnowflakeSQLExecutionError(ClickException):
|
|
77
|
-
"""
|
|
78
|
-
Could not successfully execute the Snowflake SQL statements.
|
|
79
|
-
"""
|
|
80
|
-
|
|
81
|
-
def __init__(self, queries: Optional[str] = None):
|
|
82
|
-
super().__init__(
|
|
83
|
-
f"""
|
|
84
|
-
{self.__doc__}
|
|
85
|
-
{queries if queries else ""}
|
|
86
|
-
"""
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
class ObjectAlreadyExistsError(ClickException):
|
|
91
|
-
def __init__(
|
|
92
|
-
self,
|
|
93
|
-
object_type: ObjectType,
|
|
94
|
-
name: str,
|
|
95
|
-
replace_available: bool = False,
|
|
96
|
-
):
|
|
97
|
-
msg = f"{str(object_type).capitalize()} {name} already exists."
|
|
98
|
-
if replace_available:
|
|
99
|
-
msg += " Use --replace flag to update objects."
|
|
100
|
-
super().__init__(msg)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
class NoProjectDefinitionError(ClickException):
|
|
104
|
-
def __init__(self, project_type: str, project_file: str):
|
|
105
|
-
super().__init__(
|
|
106
|
-
f"No {project_type} project definition found in {project_file}"
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
class InvalidSchemaError(ClickException):
|
|
111
|
-
def __init__(self, schema: str):
|
|
112
|
-
super().__init__(f"Invalid schema {schema}")
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
class SecretsWithoutExternalAccessIntegrationError(ClickException):
|
|
116
|
-
def __init__(self, object_name: str):
|
|
117
|
-
super().__init__(
|
|
118
|
-
f"{object_name} defined with secrets but without external integration."
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
class FileTooLargeError(ClickException):
|
|
123
|
-
def __init__(self, path: Path, size_limit_in_kb: int):
|
|
124
|
-
super().__init__(
|
|
125
|
-
f"File {path} is too large (size limit: {size_limit_in_kb} KB)"
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
class DirectoryIsNotEmptyError(ClickException):
|
|
130
|
-
def __init__(self, path: Path):
|
|
131
|
-
super().__init__(f"Directory '{path}' is not empty")
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
class ConfigFileTooWidePermissionsError(ClickException):
|
|
135
|
-
def __init__(self, path: Path):
|
|
136
|
-
super().__init__(
|
|
137
|
-
f'Configuration file {path} has too wide permissions, run `chmod 0600 "{path}"`'
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
class DatabaseNotProvidedError(ClickException):
|
|
142
|
-
def __init__(self):
|
|
143
|
-
super().__init__(
|
|
144
|
-
"Database not specified. Please update connection to add `database` parameter, or re-run command using `--database` option. Use `snow connection list` to list existing connections."
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
class SchemaNotProvidedError(ClickException):
|
|
149
|
-
def __init__(self):
|
|
150
|
-
super().__init__(
|
|
151
|
-
"Schema not specified. Please update connection to add `schema` parameter, or re-run command using `--schema` option. Use `snow connection list` to list existing connections."
|
|
152
|
-
)
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
class FQNNameError(ClickException):
|
|
156
|
-
def __init__(self, name: str):
|
|
157
|
-
super().__init__(f"Specified name '{name}' is not valid name.")
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
class FQNInconsistencyError(ClickException):
|
|
161
|
-
def __init__(self, part: str, name: str):
|
|
162
|
-
super().__init__(
|
|
163
|
-
f"{part.capitalize()} provided but name '{name}' is fully qualified name."
|
|
164
|
-
)
|
|
@@ -1,55 +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 Enum, unique
|
|
16
|
-
from typing import NamedTuple
|
|
17
|
-
|
|
18
|
-
from snowflake.cli.api.config import (
|
|
19
|
-
FEATURE_FLAGS_SECTION_PATH,
|
|
20
|
-
get_config_bool_value,
|
|
21
|
-
get_env_variable_name,
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class BooleanFlag(NamedTuple):
|
|
26
|
-
name: str
|
|
27
|
-
default: bool = False
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@unique
|
|
31
|
-
class FeatureFlagMixin(Enum):
|
|
32
|
-
def is_enabled(self) -> bool:
|
|
33
|
-
return get_config_bool_value(
|
|
34
|
-
*FEATURE_FLAGS_SECTION_PATH,
|
|
35
|
-
key=self.value.name.lower(),
|
|
36
|
-
default=self.value.default,
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
def is_disabled(self):
|
|
40
|
-
return not self.is_enabled()
|
|
41
|
-
|
|
42
|
-
def env_variable(self):
|
|
43
|
-
return get_env_variable_name(*FEATURE_FLAGS_SECTION_PATH, key=self.value.name)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
@unique
|
|
47
|
-
class FeatureFlag(FeatureFlagMixin):
|
|
48
|
-
ENABLE_STREAMLIT_EMBEDDED_STAGE = BooleanFlag(
|
|
49
|
-
"ENABLE_STREAMLIT_EMBEDDED_STAGE", False
|
|
50
|
-
)
|
|
51
|
-
ENABLE_STREAMLIT_NO_CHECKOUTS = BooleanFlag("ENABLE_STREAMLIT_NO_CHECKOUTS", False)
|
|
52
|
-
ENABLE_STREAMLIT_VERSIONED_STAGE = BooleanFlag(
|
|
53
|
-
"ENABLE_STREAMLIT_VERSIONED_STAGE", False
|
|
54
|
-
)
|
|
55
|
-
ENABLE_PROJECT_DEFINITION_V2 = BooleanFlag("ENABLE_PROJECT_DEFINITION_V2", False)
|