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,71 +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 pathlib import Path
|
|
16
|
-
from textwrap import dedent
|
|
17
|
-
|
|
18
|
-
from snowflake.cli.api.cli_global_context import cli_context
|
|
19
|
-
from snowflake.cli.api.identifiers import FQN
|
|
20
|
-
from snowflake.cli.api.sql_execution import SqlExecutionMixin
|
|
21
|
-
from snowflake.cli.plugins.connection.util import make_snowsight_url
|
|
22
|
-
from snowflake.cli.plugins.notebook.exceptions import NotebookStagePathError
|
|
23
|
-
from snowflake.cli.plugins.notebook.types import NotebookStagePath
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class NotebookManager(SqlExecutionMixin):
|
|
27
|
-
def execute(self, notebook_name: FQN):
|
|
28
|
-
query = f"EXECUTE NOTEBOOK {notebook_name.sql_identifier}()"
|
|
29
|
-
return self._execute_query(query=query)
|
|
30
|
-
|
|
31
|
-
def get_url(self, notebook_name: FQN):
|
|
32
|
-
fqn = notebook_name.using_connection(self._conn)
|
|
33
|
-
return make_snowsight_url(
|
|
34
|
-
self._conn,
|
|
35
|
-
f"/#/notebooks/{fqn.url_identifier}",
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
@staticmethod
|
|
39
|
-
def parse_stage_as_path(notebook_file: str) -> Path:
|
|
40
|
-
"""Parses notebook file path to pathlib.Path."""
|
|
41
|
-
if not notebook_file.endswith(".ipynb"):
|
|
42
|
-
raise NotebookStagePathError(notebook_file)
|
|
43
|
-
stage_path = Path(notebook_file)
|
|
44
|
-
if len(stage_path.parts) < 2:
|
|
45
|
-
raise NotebookStagePathError(notebook_file)
|
|
46
|
-
|
|
47
|
-
return stage_path
|
|
48
|
-
|
|
49
|
-
def create(
|
|
50
|
-
self,
|
|
51
|
-
notebook_name: FQN,
|
|
52
|
-
notebook_file: NotebookStagePath,
|
|
53
|
-
) -> str:
|
|
54
|
-
notebook_fqn = notebook_name.using_connection(self._conn)
|
|
55
|
-
stage_path = self.parse_stage_as_path(notebook_file)
|
|
56
|
-
|
|
57
|
-
queries = dedent(
|
|
58
|
-
f"""
|
|
59
|
-
CREATE OR REPLACE NOTEBOOK {notebook_fqn.sql_identifier}
|
|
60
|
-
FROM '{stage_path.parent}'
|
|
61
|
-
QUERY_WAREHOUSE = '{cli_context.connection.warehouse}'
|
|
62
|
-
MAIN_FILE = '{stage_path.name}';
|
|
63
|
-
// Cannot use IDENTIFIER(...)
|
|
64
|
-
ALTER NOTEBOOK {notebook_fqn.identifier} ADD LIVE VERSION FROM LAST;
|
|
65
|
-
"""
|
|
66
|
-
)
|
|
67
|
-
self._execute_queries(queries=queries)
|
|
68
|
-
|
|
69
|
-
return make_snowsight_url(
|
|
70
|
-
self._conn, f"/#/notebooks/{notebook_fqn.url_identifier}"
|
|
71
|
-
)
|
|
@@ -1,30 +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 snowflake.cli.api.plugins.command import (
|
|
16
|
-
SNOWCLI_ROOT_COMMAND_PATH,
|
|
17
|
-
CommandSpec,
|
|
18
|
-
CommandType,
|
|
19
|
-
plugin_hook_impl,
|
|
20
|
-
)
|
|
21
|
-
from snowflake.cli.plugins.notebook import commands
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@plugin_hook_impl
|
|
25
|
-
def command_spec():
|
|
26
|
-
return CommandSpec(
|
|
27
|
-
parent_command_path=SNOWCLI_ROOT_COMMAND_PATH,
|
|
28
|
-
command_type=CommandType.COMMAND_GROUP,
|
|
29
|
-
typer_instance=commands.app.create_instance(),
|
|
30
|
-
)
|
|
@@ -1,15 +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
|
-
NotebookStagePath = str
|
|
@@ -1,13 +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.
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2024 Snowflake Inc.
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
|
-
from __future__ import annotations
|
|
16
|
-
|
|
17
|
-
from typing import List, Optional, Tuple
|
|
18
|
-
|
|
19
|
-
import typer
|
|
20
|
-
from click import ClickException
|
|
21
|
-
from snowflake.cli.api.commands.snow_typer import SnowTyperFactory
|
|
22
|
-
from snowflake.cli.api.constants import ObjectType
|
|
23
|
-
from snowflake.cli.api.identifiers import FQN
|
|
24
|
-
from snowflake.cli.plugins.object.commands import (
|
|
25
|
-
ScopeOption,
|
|
26
|
-
describe,
|
|
27
|
-
drop,
|
|
28
|
-
list_,
|
|
29
|
-
scope_option, # noqa: F401
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def add_object_command_aliases(
|
|
34
|
-
app: SnowTyperFactory,
|
|
35
|
-
object_type: ObjectType,
|
|
36
|
-
name_argument: typer.Argument,
|
|
37
|
-
like_option: Optional[typer.Option],
|
|
38
|
-
scope_option: Optional[typer.Option],
|
|
39
|
-
ommit_commands: List[str] = [],
|
|
40
|
-
):
|
|
41
|
-
if "list" not in ommit_commands:
|
|
42
|
-
if not like_option:
|
|
43
|
-
raise ClickException('[like_option] have to be defined for "list" command')
|
|
44
|
-
|
|
45
|
-
if not scope_option:
|
|
46
|
-
|
|
47
|
-
@app.command("list", requires_connection=True)
|
|
48
|
-
def list_cmd(like: str = like_option, **options): # type: ignore
|
|
49
|
-
return list_(
|
|
50
|
-
object_type=object_type.value.cli_name,
|
|
51
|
-
like=like,
|
|
52
|
-
scope=ScopeOption.default,
|
|
53
|
-
**options,
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
else:
|
|
57
|
-
|
|
58
|
-
@app.command("list", requires_connection=True)
|
|
59
|
-
def list_cmd(
|
|
60
|
-
like: str = like_option, # type: ignore
|
|
61
|
-
scope: Tuple[str, str] = scope_option, # type: ignore
|
|
62
|
-
**options,
|
|
63
|
-
):
|
|
64
|
-
return list_(
|
|
65
|
-
object_type=object_type.value.cli_name,
|
|
66
|
-
like=like,
|
|
67
|
-
scope=scope,
|
|
68
|
-
**options,
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
list_cmd.__doc__ = f"Lists all available {object_type.value.sf_plural_name}."
|
|
72
|
-
|
|
73
|
-
if "drop" not in ommit_commands:
|
|
74
|
-
|
|
75
|
-
@app.command("drop", requires_connection=True)
|
|
76
|
-
def drop_cmd(name: FQN = name_argument, **options):
|
|
77
|
-
return drop(
|
|
78
|
-
object_type=object_type.value.cli_name,
|
|
79
|
-
object_name=name,
|
|
80
|
-
**options,
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
drop_cmd.__doc__ = f"Drops {object_type.value.sf_name} with given name."
|
|
84
|
-
|
|
85
|
-
if "describe" not in ommit_commands:
|
|
86
|
-
|
|
87
|
-
@app.command("describe", requires_connection=True)
|
|
88
|
-
def describe_cmd(name: FQN = name_argument, **options):
|
|
89
|
-
return describe(
|
|
90
|
-
object_type=object_type.value.cli_name,
|
|
91
|
-
object_name=name,
|
|
92
|
-
**options,
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
describe_cmd.__doc__ = f"Provides description of {object_type.value.sf_name}."
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2024 Snowflake Inc.
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
|
-
from __future__ import annotations
|
|
16
|
-
|
|
17
|
-
from typing import List, Optional, Tuple
|
|
18
|
-
|
|
19
|
-
import typer
|
|
20
|
-
from click import ClickException
|
|
21
|
-
from snowflake.cli.api.commands.flags import (
|
|
22
|
-
IdentifierType,
|
|
23
|
-
like_option,
|
|
24
|
-
parse_key_value_variables,
|
|
25
|
-
)
|
|
26
|
-
from snowflake.cli.api.commands.snow_typer import SnowTyperFactory
|
|
27
|
-
from snowflake.cli.api.constants import SUPPORTED_OBJECTS, VALID_SCOPES
|
|
28
|
-
from snowflake.cli.api.identifiers import FQN
|
|
29
|
-
from snowflake.cli.api.output.types import MessageResult, QueryResult
|
|
30
|
-
from snowflake.cli.api.project.util import is_valid_identifier
|
|
31
|
-
from snowflake.cli.plugins.object.manager import ObjectManager
|
|
32
|
-
|
|
33
|
-
app = SnowTyperFactory(
|
|
34
|
-
name="object",
|
|
35
|
-
help="Manages Snowflake objects like warehouses and stages",
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
NameArgument = typer.Argument(
|
|
40
|
-
help="Name of the object.", show_default=False, click_type=IdentifierType()
|
|
41
|
-
)
|
|
42
|
-
ObjectArgument = typer.Argument(
|
|
43
|
-
help="Type of object. For example table, database, compute-pool.",
|
|
44
|
-
case_sensitive=False,
|
|
45
|
-
show_default=False,
|
|
46
|
-
)
|
|
47
|
-
# TODO: add documentation link
|
|
48
|
-
ObjectAttributesArgument = typer.Argument(
|
|
49
|
-
None,
|
|
50
|
-
help="""Object attributes provided as a list of key=value pairs,
|
|
51
|
-
for example name=my_db comment='created with Snowflake CLI'.
|
|
52
|
-
|
|
53
|
-
Check documentation for the full list of available parameters
|
|
54
|
-
for every object.
|
|
55
|
-
""",
|
|
56
|
-
show_default=False,
|
|
57
|
-
)
|
|
58
|
-
# TODO: add documentation link
|
|
59
|
-
ObjectDefinitionJsonOption = typer.Option(
|
|
60
|
-
None,
|
|
61
|
-
"--json",
|
|
62
|
-
help="""Object definition in JSON format, for example
|
|
63
|
-
\'{"name": "my_db", "comment": "created with Snowflake CLI"}\'.
|
|
64
|
-
|
|
65
|
-
Check documentation for the full list of available parameters
|
|
66
|
-
for every object.
|
|
67
|
-
""",
|
|
68
|
-
show_default=False,
|
|
69
|
-
)
|
|
70
|
-
LikeOption = like_option(
|
|
71
|
-
help_example='`list function --like "my%"` lists all functions that begin with “my”',
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
def _scope_validate(object_type: str, scope: Tuple[str, str]):
|
|
76
|
-
if scope[1] is not None and not is_valid_identifier(scope[1]):
|
|
77
|
-
raise ClickException("scope name must be a valid identifier")
|
|
78
|
-
if scope[0] is not None and scope[0].lower() not in VALID_SCOPES:
|
|
79
|
-
raise ClickException(
|
|
80
|
-
f"scope must be one of the following: {', '.join(VALID_SCOPES)}"
|
|
81
|
-
)
|
|
82
|
-
if scope[0] == "compute-pool" and object_type != "service":
|
|
83
|
-
raise ClickException("compute-pool scope is only supported for listing service")
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
def scope_option(help_example: str):
|
|
87
|
-
return typer.Option(
|
|
88
|
-
(None, None),
|
|
89
|
-
"--in",
|
|
90
|
-
help=f"Specifies the scope of this command using '--in <scope> <name>', for example {help_example}.",
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
ScopeOption = scope_option(
|
|
95
|
-
help_example="`list table --in database my_db`. Some object types have specialized scopes (e.g. list service --in compute-pool my_pool)"
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
SUPPORTED_TYPES_MSG = "\n\nSupported types: " + ", ".join(SUPPORTED_OBJECTS)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
@app.command(
|
|
102
|
-
"list",
|
|
103
|
-
help=f"Lists all available Snowflake objects of given type.{SUPPORTED_TYPES_MSG}",
|
|
104
|
-
requires_connection=True,
|
|
105
|
-
)
|
|
106
|
-
def list_(
|
|
107
|
-
object_type: str = ObjectArgument,
|
|
108
|
-
like: str = LikeOption,
|
|
109
|
-
scope: Tuple[str, str] = ScopeOption,
|
|
110
|
-
**options,
|
|
111
|
-
):
|
|
112
|
-
_scope_validate(object_type, scope)
|
|
113
|
-
return QueryResult(
|
|
114
|
-
ObjectManager().show(object_type=object_type, like=like, scope=scope)
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
@app.command(
|
|
119
|
-
help=f"Drops Snowflake object of given name and type. {SUPPORTED_TYPES_MSG}",
|
|
120
|
-
requires_connection=True,
|
|
121
|
-
)
|
|
122
|
-
def drop(object_type: str = ObjectArgument, object_name: FQN = NameArgument, **options):
|
|
123
|
-
return QueryResult(ObjectManager().drop(object_type=object_type, fqn=object_name))
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
# Image repository is the only supported object that does not have a DESCRIBE command.
|
|
127
|
-
DESCRIBE_SUPPORTED_TYPES_MSG = f"\n\nSupported types: {', '.join(obj for obj in SUPPORTED_OBJECTS if obj != 'image-repository')}"
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
@app.command(
|
|
131
|
-
help=f"Provides description of an object of given type. {DESCRIBE_SUPPORTED_TYPES_MSG}",
|
|
132
|
-
requires_connection=True,
|
|
133
|
-
)
|
|
134
|
-
def describe(
|
|
135
|
-
object_type: str = ObjectArgument, object_name: FQN = NameArgument, **options
|
|
136
|
-
):
|
|
137
|
-
return QueryResult(
|
|
138
|
-
ObjectManager().describe(object_type=object_type, fqn=object_name)
|
|
139
|
-
)
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
@app.command(name="create", requires_connection=True)
|
|
143
|
-
def create(
|
|
144
|
-
object_type: str = ObjectArgument,
|
|
145
|
-
object_attributes: Optional[List[str]] = ObjectAttributesArgument,
|
|
146
|
-
object_json: str = ObjectDefinitionJsonOption,
|
|
147
|
-
**options,
|
|
148
|
-
):
|
|
149
|
-
"""
|
|
150
|
-
Create an object of a given type. Check documentation for the list of supported objects
|
|
151
|
-
and parameters.
|
|
152
|
-
"""
|
|
153
|
-
import json
|
|
154
|
-
|
|
155
|
-
if object_attributes and object_json:
|
|
156
|
-
raise ClickException(
|
|
157
|
-
"Conflict: both object attributes and JSON definition are provided"
|
|
158
|
-
)
|
|
159
|
-
|
|
160
|
-
if object_json:
|
|
161
|
-
object_data = json.loads(object_json)
|
|
162
|
-
elif object_attributes:
|
|
163
|
-
|
|
164
|
-
def _parse_if_json(value: str):
|
|
165
|
-
try:
|
|
166
|
-
return json.loads(value)
|
|
167
|
-
except json.JSONDecodeError:
|
|
168
|
-
return value
|
|
169
|
-
|
|
170
|
-
object_data = {
|
|
171
|
-
v.key: _parse_if_json(v.value)
|
|
172
|
-
for v in parse_key_value_variables(object_attributes)
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
else:
|
|
176
|
-
raise ClickException(
|
|
177
|
-
"Provide either list of object attributes, or object definition in JSON format"
|
|
178
|
-
)
|
|
179
|
-
|
|
180
|
-
result = ObjectManager().create(object_type=object_type, object_data=object_data)
|
|
181
|
-
return MessageResult(result)
|
|
@@ -1,85 +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 typing import Optional
|
|
19
|
-
|
|
20
|
-
from click import ClickException
|
|
21
|
-
from snowflake.cli.api.commands.flags import OverrideableOption
|
|
22
|
-
from snowflake.cli.api.project.util import (
|
|
23
|
-
VALID_IDENTIFIER_REGEX,
|
|
24
|
-
is_valid_identifier,
|
|
25
|
-
to_string_literal,
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
@dataclass
|
|
30
|
-
class Tag:
|
|
31
|
-
name: str
|
|
32
|
-
value: str
|
|
33
|
-
|
|
34
|
-
def __post_init__(self):
|
|
35
|
-
if not is_valid_identifier(self.name):
|
|
36
|
-
raise ValueError("name of a tag must be a valid Snowflake identifier")
|
|
37
|
-
|
|
38
|
-
def value_string_literal(self):
|
|
39
|
-
return to_string_literal(self.value)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
class TagError(ClickException):
|
|
43
|
-
def __init__(self):
|
|
44
|
-
super().__init__(
|
|
45
|
-
"tag must be in the format <name>=<value> where 'name' is a valid identifier and value is a string"
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def _parse_tag(tag: str) -> Tag:
|
|
50
|
-
import re
|
|
51
|
-
|
|
52
|
-
identifier_pattern = rf"(?P<tag_name>{VALID_IDENTIFIER_REGEX})"
|
|
53
|
-
value_pattern = r"(?P<tag_value>.+)"
|
|
54
|
-
result = re.fullmatch(rf"{identifier_pattern}={value_pattern}", tag)
|
|
55
|
-
if result is not None:
|
|
56
|
-
try:
|
|
57
|
-
return Tag(result.group("tag_name"), result.group("tag_value"))
|
|
58
|
-
except ValueError:
|
|
59
|
-
raise TagError()
|
|
60
|
-
else:
|
|
61
|
-
raise TagError()
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"""
|
|
65
|
-
Provides a common interface for all commands that accept a tag option (e.g. when altering the tag of an object).
|
|
66
|
-
Parses the input string in the format "name=value" into a Tag object with 'name' and 'value' properties.
|
|
67
|
-
"""
|
|
68
|
-
TagOption = OverrideableOption(
|
|
69
|
-
None, "--tag", help=f"Tag for the object.", parser=_parse_tag, metavar="NAME=VALUE"
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def _comment_callback(comment: Optional[str]):
|
|
74
|
-
if comment is None:
|
|
75
|
-
return comment
|
|
76
|
-
return to_string_literal(comment)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"""
|
|
80
|
-
Provides a common interface for all commands that accept a comment option (e.g. when creating a new object).
|
|
81
|
-
Parses the input string into a string literal.
|
|
82
|
-
"""
|
|
83
|
-
CommentOption = OverrideableOption(
|
|
84
|
-
None, "--comment", help="Comment for the object.", callback=_comment_callback
|
|
85
|
-
)
|
|
@@ -1,97 +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 Any, Dict, Optional, Tuple, Union
|
|
19
|
-
|
|
20
|
-
from click import ClickException
|
|
21
|
-
from snowflake.cli.api.constants import (
|
|
22
|
-
OBJECT_TO_NAMES,
|
|
23
|
-
ObjectNames,
|
|
24
|
-
)
|
|
25
|
-
from snowflake.cli.api.identifiers import FQN
|
|
26
|
-
from snowflake.cli.api.rest_api import RestApi
|
|
27
|
-
from snowflake.cli.api.sql_execution import SqlExecutionMixin
|
|
28
|
-
from snowflake.connector import ProgrammingError
|
|
29
|
-
from snowflake.connector.cursor import SnowflakeCursor
|
|
30
|
-
from snowflake.connector.errors import BadRequest
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def _get_object_names(object_type: str) -> ObjectNames:
|
|
34
|
-
object_type = object_type.lower()
|
|
35
|
-
if object_type.lower() not in OBJECT_TO_NAMES:
|
|
36
|
-
raise ClickException(f"Object of type {object_type} is not supported.")
|
|
37
|
-
return OBJECT_TO_NAMES[object_type]
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
class ObjectManager(SqlExecutionMixin):
|
|
41
|
-
def show(
|
|
42
|
-
self,
|
|
43
|
-
*,
|
|
44
|
-
object_type: str,
|
|
45
|
-
like: Optional[str] = None,
|
|
46
|
-
scope: Union[Tuple[str, str], Tuple[None, None]] = (None, None),
|
|
47
|
-
**kwargs,
|
|
48
|
-
) -> SnowflakeCursor:
|
|
49
|
-
object_name = _get_object_names(object_type).sf_plural_name
|
|
50
|
-
query = f"show {object_name}"
|
|
51
|
-
if like:
|
|
52
|
-
query += f" like '{like}'"
|
|
53
|
-
if scope[0] is not None:
|
|
54
|
-
query += f" in {scope[0].replace('-', ' ')} {scope[1]}"
|
|
55
|
-
return self._execute_query(query, **kwargs)
|
|
56
|
-
|
|
57
|
-
def drop(self, *, object_type: str, fqn: FQN) -> SnowflakeCursor:
|
|
58
|
-
object_name = _get_object_names(object_type).sf_name
|
|
59
|
-
return self._execute_query(f"drop {object_name} {fqn.sql_identifier}")
|
|
60
|
-
|
|
61
|
-
def describe(self, *, object_type: str, fqn: FQN):
|
|
62
|
-
# Image repository is the only supported object that does not have a DESCRIBE command.
|
|
63
|
-
if object_type == "image-repository":
|
|
64
|
-
raise ClickException(
|
|
65
|
-
f"Describe is currently not supported for object of type image-repository"
|
|
66
|
-
)
|
|
67
|
-
object_name = _get_object_names(object_type).sf_name
|
|
68
|
-
return self._execute_query(f"describe {object_name} {fqn.sql_identifier}")
|
|
69
|
-
|
|
70
|
-
def object_exists(self, *, object_type: str, fqn: FQN):
|
|
71
|
-
try:
|
|
72
|
-
self.describe(object_type=object_type, fqn=fqn)
|
|
73
|
-
return True
|
|
74
|
-
except ProgrammingError:
|
|
75
|
-
return False
|
|
76
|
-
|
|
77
|
-
def create(self, object_type: str, object_data: Dict[str, Any]) -> str:
|
|
78
|
-
rest = RestApi(self._conn)
|
|
79
|
-
url = rest.determine_url_for_create_query(object_type=object_type)
|
|
80
|
-
|
|
81
|
-
try:
|
|
82
|
-
response = rest.send_rest_request(url=url, method="post", data=object_data)
|
|
83
|
-
# workaround as SnowflakeRestful class ignores some errors, dropping their info and returns {} instead.
|
|
84
|
-
if not response:
|
|
85
|
-
raise ClickException(
|
|
86
|
-
dedent(
|
|
87
|
-
""" An unexpected error occurred while creating the object. Try again with --debug for more info.
|
|
88
|
-
Most probable reasons:
|
|
89
|
-
* object you are trying to create already exists
|
|
90
|
-
* role you are using do not have permissions to create this object"""
|
|
91
|
-
)
|
|
92
|
-
)
|
|
93
|
-
return response["status"]
|
|
94
|
-
except BadRequest:
|
|
95
|
-
raise ClickException(
|
|
96
|
-
"Incorrect object definition (arguments misspelled or malformatted)."
|
|
97
|
-
)
|
|
@@ -1,30 +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 snowflake.cli.api.plugins.command import (
|
|
16
|
-
SNOWCLI_ROOT_COMMAND_PATH,
|
|
17
|
-
CommandSpec,
|
|
18
|
-
CommandType,
|
|
19
|
-
plugin_hook_impl,
|
|
20
|
-
)
|
|
21
|
-
from snowflake.cli.plugins.object import commands
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@plugin_hook_impl
|
|
25
|
-
def command_spec():
|
|
26
|
-
return CommandSpec(
|
|
27
|
-
parent_command_path=SNOWCLI_ROOT_COMMAND_PATH,
|
|
28
|
-
command_type=CommandType.COMMAND_GROUP,
|
|
29
|
-
typer_instance=commands.app.create_instance(),
|
|
30
|
-
)
|
|
@@ -1,15 +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
|
-
# TODO 3.0: remove this file
|