snowflake-cli-labs 2.4.0rc1__py3-none-any.whl → 2.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- snowflake/cli/__about__.py +15 -1
- snowflake/cli/__init__.py +13 -0
- snowflake/cli/api/__init__.py +14 -0
- snowflake/cli/api/cli_global_context.py +26 -0
- snowflake/cli/api/commands/__init__.py +13 -0
- snowflake/cli/api/commands/alias.py +14 -0
- snowflake/cli/api/commands/decorators.py +14 -0
- snowflake/cli/api/commands/experimental_behaviour.py +14 -0
- snowflake/cli/api/commands/flags.py +21 -1
- snowflake/cli/api/commands/project_initialisation.py +19 -2
- snowflake/cli/api/commands/snow_typer.py +90 -1
- snowflake/cli/api/config.py +14 -0
- snowflake/cli/api/console/__init__.py +14 -0
- snowflake/cli/api/console/abc.py +14 -0
- snowflake/cli/api/console/console.py +14 -0
- snowflake/cli/api/console/enum.py +14 -0
- snowflake/cli/api/constants.py +14 -0
- snowflake/cli/api/exceptions.py +22 -0
- snowflake/cli/api/feature_flags.py +14 -1
- snowflake/cli/api/identifiers.py +16 -2
- snowflake/cli/api/output/__init__.py +13 -0
- snowflake/cli/api/output/formats.py +14 -0
- snowflake/cli/api/output/types.py +14 -0
- snowflake/cli/api/plugins/__init__.py +13 -0
- snowflake/cli/api/plugins/command/__init__.py +14 -0
- snowflake/cli/api/plugins/command/plugin_hook_specs.py +14 -0
- snowflake/cli/api/plugins/plugin_config.py +14 -0
- snowflake/cli/api/project/__init__.py +13 -0
- snowflake/cli/api/project/definition.py +54 -8
- snowflake/cli/api/project/definition_manager.py +28 -2
- snowflake/cli/api/project/errors.py +14 -0
- snowflake/cli/api/project/schemas/__init__.py +13 -0
- snowflake/cli/api/project/schemas/identifier_model.py +14 -0
- snowflake/cli/api/project/schemas/native_app/__init__.py +13 -0
- snowflake/cli/api/project/schemas/native_app/application.py +14 -0
- snowflake/cli/api/project/schemas/native_app/native_app.py +35 -0
- snowflake/cli/api/project/schemas/native_app/package.py +14 -0
- snowflake/cli/api/project/schemas/native_app/path_mapping.py +15 -1
- snowflake/cli/api/project/schemas/project_definition.py +14 -0
- snowflake/cli/api/project/schemas/snowpark/__init__.py +13 -0
- snowflake/cli/api/project/schemas/snowpark/argument.py +14 -0
- snowflake/cli/api/project/schemas/snowpark/callable.py +14 -0
- snowflake/cli/api/project/schemas/snowpark/snowpark.py +14 -0
- snowflake/cli/api/project/schemas/streamlit/__init__.py +13 -0
- snowflake/cli/api/project/schemas/streamlit/streamlit.py +14 -0
- snowflake/cli/api/project/schemas/updatable_model.py +14 -0
- snowflake/cli/api/project/util.py +32 -3
- snowflake/cli/api/secure_path.py +59 -7
- snowflake/cli/api/secure_utils.py +14 -0
- snowflake/cli/api/sql_execution.py +14 -0
- snowflake/cli/api/utils/__init__.py +13 -0
- snowflake/cli/api/utils/cursor.py +14 -0
- snowflake/cli/api/utils/definition_rendering.py +271 -0
- snowflake/cli/api/utils/dict_utils.py +73 -0
- snowflake/cli/api/utils/error_handling.py +14 -0
- snowflake/cli/api/utils/graph.py +97 -0
- snowflake/cli/api/utils/models.py +32 -0
- snowflake/cli/api/utils/naming_utils.py +13 -0
- snowflake/cli/api/utils/path_utils.py +14 -0
- snowflake/cli/api/utils/rendering.py +21 -152
- snowflake/cli/api/utils/types.py +18 -1
- snowflake/cli/app/__init__.py +14 -0
- snowflake/cli/app/__main__.py +14 -0
- snowflake/cli/app/api_impl/__init__.py +13 -0
- snowflake/cli/app/api_impl/plugin/__init__.py +13 -0
- snowflake/cli/app/api_impl/plugin/plugin_config_provider_impl.py +14 -0
- snowflake/cli/app/cli_app.py +14 -0
- snowflake/cli/app/commands_registration/__init__.py +14 -0
- snowflake/cli/app/commands_registration/builtin_plugins.py +14 -0
- snowflake/cli/app/commands_registration/command_plugins_loader.py +14 -0
- snowflake/cli/app/commands_registration/commands_registration_with_callbacks.py +14 -0
- snowflake/cli/app/commands_registration/exception_logging.py +14 -0
- snowflake/cli/app/commands_registration/threadsafe.py +14 -0
- snowflake/cli/app/commands_registration/typer_registration.py +14 -0
- snowflake/cli/app/constants.py +14 -1
- snowflake/cli/app/dev/__init__.py +13 -0
- snowflake/cli/app/dev/commands_structure.py +14 -0
- snowflake/cli/app/dev/docs/__init__.py +13 -0
- snowflake/cli/app/dev/docs/generator.py +14 -0
- snowflake/cli/app/dev/pycharm_remote_debug.py +14 -0
- snowflake/cli/app/loggers.py +14 -0
- snowflake/cli/app/main_typer.py +14 -0
- snowflake/cli/app/printing.py +17 -0
- snowflake/cli/app/snow_connector.py +17 -4
- snowflake/cli/app/telemetry.py +14 -0
- snowflake/cli/plugins/__init__.py +13 -0
- snowflake/cli/plugins/connection/__init__.py +13 -0
- snowflake/cli/plugins/connection/commands.py +27 -2
- snowflake/cli/plugins/connection/plugin_spec.py +15 -1
- snowflake/cli/plugins/connection/util.py +21 -1
- snowflake/cli/plugins/cortex/__init__.py +13 -0
- snowflake/cli/plugins/cortex/commands.py +16 -2
- snowflake/cli/plugins/cortex/constants.py +14 -0
- snowflake/cli/plugins/cortex/manager.py +14 -0
- snowflake/cli/plugins/cortex/plugin_spec.py +15 -1
- snowflake/cli/plugins/cortex/types.py +14 -0
- snowflake/cli/plugins/git/__init__.py +13 -0
- snowflake/cli/plugins/git/commands.py +16 -2
- snowflake/cli/plugins/git/manager.py +14 -0
- snowflake/cli/plugins/git/plugin_spec.py +15 -1
- snowflake/cli/plugins/nativeapp/__init__.py +13 -0
- snowflake/cli/plugins/nativeapp/artifacts.py +202 -98
- snowflake/cli/plugins/nativeapp/codegen/__init__.py +13 -0
- snowflake/cli/plugins/nativeapp/codegen/artifact_processor.py +14 -0
- snowflake/cli/plugins/nativeapp/codegen/compiler.py +14 -0
- snowflake/cli/plugins/nativeapp/codegen/sandbox.py +14 -0
- snowflake/cli/plugins/nativeapp/codegen/snowpark/callback_source.py.jinja +5 -5
- snowflake/cli/plugins/nativeapp/codegen/snowpark/extension_function_utils.py +34 -13
- snowflake/cli/plugins/nativeapp/codegen/snowpark/models.py +14 -0
- snowflake/cli/plugins/nativeapp/codegen/snowpark/python_processor.py +52 -13
- snowflake/cli/plugins/nativeapp/commands.py +63 -10
- snowflake/cli/plugins/nativeapp/common_flags.py +20 -0
- snowflake/cli/plugins/nativeapp/constants.py +15 -0
- snowflake/cli/plugins/nativeapp/exceptions.py +23 -2
- snowflake/cli/plugins/nativeapp/init.py +14 -0
- snowflake/cli/plugins/nativeapp/manager.py +118 -25
- snowflake/cli/plugins/nativeapp/plugin_spec.py +15 -1
- snowflake/cli/plugins/nativeapp/policy.py +14 -0
- snowflake/cli/plugins/nativeapp/run_processor.py +22 -3
- snowflake/cli/plugins/nativeapp/teardown_processor.py +14 -0
- snowflake/cli/plugins/nativeapp/utils.py +14 -0
- snowflake/cli/plugins/nativeapp/version/__init__.py +13 -0
- snowflake/cli/plugins/nativeapp/version/commands.py +19 -4
- snowflake/cli/plugins/nativeapp/version/version_processor.py +26 -4
- snowflake/cli/plugins/notebook/__init__.py +13 -0
- snowflake/cli/plugins/notebook/commands.py +16 -4
- snowflake/cli/plugins/notebook/exceptions.py +14 -0
- snowflake/cli/plugins/notebook/manager.py +14 -0
- snowflake/cli/plugins/notebook/plugin_spec.py +15 -1
- snowflake/cli/plugins/notebook/types.py +14 -0
- snowflake/cli/plugins/object/__init__.py +13 -11
- snowflake/cli/plugins/object/command_aliases.py +20 -6
- snowflake/cli/plugins/object/commands.py +16 -2
- snowflake/cli/plugins/object/common.py +14 -0
- snowflake/cli/plugins/object/manager.py +14 -0
- snowflake/cli/plugins/object/plugin_spec.py +16 -2
- snowflake/cli/plugins/object_stage_deprecated/__init__.py +14 -0
- snowflake/cli/plugins/object_stage_deprecated/commands.py +16 -2
- snowflake/cli/plugins/object_stage_deprecated/plugin_spec.py +16 -4
- snowflake/cli/plugins/snowpark/__init__.py +13 -4
- snowflake/cli/plugins/snowpark/commands.py +18 -2
- snowflake/cli/plugins/snowpark/common.py +15 -0
- snowflake/cli/plugins/snowpark/manager.py +14 -0
- snowflake/cli/plugins/snowpark/models.py +15 -1
- snowflake/cli/plugins/snowpark/package/__init__.py +13 -0
- snowflake/cli/plugins/snowpark/package/anaconda_packages.py +14 -0
- snowflake/cli/plugins/snowpark/package/commands.py +16 -2
- snowflake/cli/plugins/snowpark/package/manager.py +14 -0
- snowflake/cli/plugins/snowpark/package/utils.py +14 -0
- snowflake/cli/plugins/snowpark/package_utils.py +15 -1
- snowflake/cli/plugins/snowpark/plugin_spec.py +16 -2
- snowflake/cli/plugins/snowpark/snowpark_package_paths.py +14 -0
- snowflake/cli/plugins/snowpark/snowpark_shared.py +14 -0
- snowflake/cli/plugins/snowpark/zipper.py +20 -3
- snowflake/cli/plugins/spcs/__init__.py +16 -2
- snowflake/cli/plugins/spcs/common.py +14 -0
- snowflake/cli/plugins/spcs/compute_pool/__init__.py +13 -0
- snowflake/cli/plugins/spcs/compute_pool/commands.py +16 -2
- snowflake/cli/plugins/spcs/compute_pool/manager.py +14 -0
- snowflake/cli/plugins/spcs/image_registry/__init__.py +13 -0
- snowflake/cli/plugins/spcs/image_registry/commands.py +16 -2
- snowflake/cli/plugins/spcs/image_registry/manager.py +16 -0
- snowflake/cli/plugins/spcs/image_repository/__init__.py +13 -0
- snowflake/cli/plugins/spcs/image_repository/commands.py +16 -2
- snowflake/cli/plugins/spcs/image_repository/manager.py +14 -0
- snowflake/cli/plugins/spcs/jobs/__init__.py +13 -0
- snowflake/cli/plugins/spcs/jobs/commands.py +17 -3
- snowflake/cli/plugins/spcs/jobs/manager.py +14 -0
- snowflake/cli/plugins/spcs/plugin_spec.py +15 -1
- snowflake/cli/plugins/spcs/services/__init__.py +13 -0
- snowflake/cli/plugins/spcs/services/commands.py +16 -2
- snowflake/cli/plugins/spcs/services/manager.py +14 -0
- snowflake/cli/plugins/sql/__init__.py +13 -0
- snowflake/cli/plugins/sql/commands.py +16 -2
- snowflake/cli/plugins/sql/manager.py +14 -0
- snowflake/cli/plugins/sql/plugin_spec.py +15 -1
- snowflake/cli/plugins/sql/snowsql_templating.py +14 -0
- snowflake/cli/plugins/stage/__init__.py +13 -0
- snowflake/cli/plugins/stage/commands.py +17 -3
- snowflake/cli/plugins/stage/diff.py +14 -0
- snowflake/cli/plugins/stage/manager.py +16 -5
- snowflake/cli/plugins/stage/plugin_spec.py +16 -2
- snowflake/cli/plugins/streamlit/__init__.py +13 -0
- snowflake/cli/plugins/streamlit/commands.py +16 -2
- snowflake/cli/plugins/streamlit/manager.py +14 -0
- snowflake/cli/plugins/streamlit/plugin_spec.py +15 -1
- snowflake/cli/templates/default_snowpark/app/__init__.py +13 -0
- snowflake/cli/templates/default_snowpark/app/common.py +15 -0
- snowflake/cli/templates/default_snowpark/app/functions.py +14 -0
- snowflake/cli/templates/default_snowpark/app/procedures.py +14 -0
- snowflake/cli/templates/default_snowpark/snowflake.yml +1 -1
- snowflake/cli/templates/default_streamlit/common/hello.py +15 -0
- snowflake/cli/templates/default_streamlit/pages/my_page.py +14 -0
- snowflake/cli/templates/default_streamlit/snowflake.yml +1 -1
- snowflake/cli/templates/default_streamlit/streamlit_app.py +14 -0
- {snowflake_cli_labs-2.4.0rc1.dist-info → snowflake_cli_labs-2.5.0.dist-info}/METADATA +23 -7
- snowflake_cli_labs-2.5.0.dist-info/RECORD +206 -0
- snowflake/cli/plugins/nativeapp/feature_flags.py +0 -10
- snowflake/cli/templates/environment.yml.jinja +0 -5
- snowflake/cli/templates/streamlit_app_launcher.py.jinja +0 -19
- snowflake_cli_labs-2.4.0rc1.dist-info/RECORD +0 -206
- {snowflake_cli_labs-2.4.0rc1.dist-info → snowflake_cli_labs-2.5.0.dist-info}/WHEEL +0 -0
- {snowflake_cli_labs-2.4.0rc1.dist-info → snowflake_cli_labs-2.5.0.dist-info}/entry_points.txt +0 -0
- {snowflake_cli_labs-2.4.0rc1.dist-info → snowflake_cli_labs-2.5.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
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,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
17
|
import sys
|
|
@@ -1,22 +1,30 @@
|
|
|
1
|
+
# Copyright (c) 2024 Snowflake Inc.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
|
-
import re
|
|
4
|
-
from collections import defaultdict, deque
|
|
5
17
|
from pathlib import Path
|
|
6
18
|
from textwrap import dedent
|
|
7
|
-
from typing import Dict,
|
|
19
|
+
from typing import Dict, Optional
|
|
8
20
|
|
|
9
21
|
import jinja2
|
|
10
22
|
from click import ClickException
|
|
11
|
-
from jinja2 import Environment, StrictUndefined,
|
|
23
|
+
from jinja2 import Environment, StrictUndefined, loaders
|
|
12
24
|
from snowflake.cli.api.cli_global_context import cli_context
|
|
13
|
-
from snowflake.cli.api.project.schemas.project_definition import (
|
|
14
|
-
ProjectDefinition,
|
|
15
|
-
)
|
|
16
25
|
from snowflake.cli.api.secure_path import UNLIMITED, SecurePath
|
|
17
|
-
from snowflake.cli.api.utils.models import EnvironWithDefinedDictFallback
|
|
18
26
|
|
|
19
|
-
|
|
27
|
+
CONTEXT_KEY = "ctx"
|
|
20
28
|
_YML_TEMPLATE_START = "<%"
|
|
21
29
|
_YML_TEMPLATE_END = "%>"
|
|
22
30
|
|
|
@@ -55,7 +63,7 @@ def _env_bootstrap(env: Environment) -> Environment:
|
|
|
55
63
|
return env
|
|
56
64
|
|
|
57
65
|
|
|
58
|
-
def get_snowflake_cli_jinja_env():
|
|
66
|
+
def get_snowflake_cli_jinja_env() -> Environment:
|
|
59
67
|
_random_block = "___very___unique___block___to___disable___logic___blocks___"
|
|
60
68
|
return _env_bootstrap(
|
|
61
69
|
Environment(
|
|
@@ -115,152 +123,13 @@ def jinja_render_from_file(
|
|
|
115
123
|
return rendered_result
|
|
116
124
|
|
|
117
125
|
|
|
118
|
-
def _add_project_context(project_definition: ProjectDefinition) -> Dict:
|
|
119
|
-
"""
|
|
120
|
-
Updates the external data with variables from snowflake.yml definition file.
|
|
121
|
-
"""
|
|
122
|
-
context_data = _resolve_variables_in_project(project_definition)
|
|
123
|
-
return context_data
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
def _remove_ctx_env_prefix(text: str) -> str:
|
|
127
|
-
prefix = "ctx.env."
|
|
128
|
-
if text.startswith(prefix):
|
|
129
|
-
return text[len(prefix) :]
|
|
130
|
-
return text
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
def string_includes_template(text: str) -> bool:
|
|
134
|
-
return bool(re.search(rf"{_YML_TEMPLATE_START}.+{_YML_TEMPLATE_END}", text))
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
def _resolve_variables_in_project(project_definition: ProjectDefinition):
|
|
138
|
-
# If there's project definition file then resolve variables from it
|
|
139
|
-
if not project_definition or not project_definition.meets_version_requirement(
|
|
140
|
-
"1.1"
|
|
141
|
-
):
|
|
142
|
-
return {_CONTEXT_KEY: {"env": EnvironWithDefinedDictFallback({})}}
|
|
143
|
-
|
|
144
|
-
variables_data: EnvironWithDefinedDictFallback = cast(
|
|
145
|
-
EnvironWithDefinedDictFallback, project_definition.env
|
|
146
|
-
)
|
|
147
|
-
|
|
148
|
-
env_with_unresolved_keys: List[str] = _get_variables_with_dependencies(
|
|
149
|
-
variables_data
|
|
150
|
-
)
|
|
151
|
-
other_env = set(variables_data) - set(env_with_unresolved_keys)
|
|
152
|
-
env = get_snowflake_cli_jinja_env()
|
|
153
|
-
context_data = {_CONTEXT_KEY: project_definition}
|
|
154
|
-
|
|
155
|
-
# Resolve env section dependencies
|
|
156
|
-
while env_with_unresolved_keys:
|
|
157
|
-
key = env_with_unresolved_keys.pop()
|
|
158
|
-
value = variables_data[key]
|
|
159
|
-
if not isinstance(value, str):
|
|
160
|
-
continue
|
|
161
|
-
try: # try to evaluate the template given current state of know variables
|
|
162
|
-
variables_data[key] = env.from_string(value).render(context_data)
|
|
163
|
-
if string_includes_template(variables_data[key]):
|
|
164
|
-
env_with_unresolved_keys.append(key)
|
|
165
|
-
except UndefinedError:
|
|
166
|
-
env_with_unresolved_keys.append(key)
|
|
167
|
-
|
|
168
|
-
# Resolve templates in variables without references, for example
|
|
169
|
-
for key in other_env:
|
|
170
|
-
variable_value = variables_data[key]
|
|
171
|
-
if not isinstance(variable_value, str):
|
|
172
|
-
continue
|
|
173
|
-
variables_data[key] = env.from_string(variable_value).render(context_data)
|
|
174
|
-
|
|
175
|
-
return context_data
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
def _check_for_cycles(nodes: defaultdict):
|
|
179
|
-
nodes = nodes.copy()
|
|
180
|
-
for key in list(nodes):
|
|
181
|
-
q = deque([key])
|
|
182
|
-
visited: List[str] = []
|
|
183
|
-
while q:
|
|
184
|
-
curr = q.popleft()
|
|
185
|
-
if curr in visited:
|
|
186
|
-
raise ClickException(
|
|
187
|
-
"Cycle detected between variables: {}".format(" -> ".join(visited))
|
|
188
|
-
)
|
|
189
|
-
# Only nodes that have references can cause cycles
|
|
190
|
-
if curr in nodes:
|
|
191
|
-
visited.append(curr)
|
|
192
|
-
q.extendleft(nodes[curr])
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
def _get_variables_with_dependencies(variables_data: EnvironWithDefinedDictFallback):
|
|
196
|
-
"""
|
|
197
|
-
Checks consistency of provided dictionary by
|
|
198
|
-
1. checking reference cycles
|
|
199
|
-
2. checking for missing variables
|
|
200
|
-
"""
|
|
201
|
-
# Variables that are not specified in env section
|
|
202
|
-
missing_variables: Set[str] = set()
|
|
203
|
-
# Variables that require other variables
|
|
204
|
-
variables_with_dependencies = defaultdict(list)
|
|
205
|
-
|
|
206
|
-
for key, value in variables_data.items():
|
|
207
|
-
# Templates are reserved only to string variables
|
|
208
|
-
if not isinstance(value, str):
|
|
209
|
-
continue
|
|
210
|
-
|
|
211
|
-
required_variables = _search_for_required_variables(value)
|
|
212
|
-
|
|
213
|
-
if required_variables:
|
|
214
|
-
variables_with_dependencies[key] = required_variables
|
|
215
|
-
|
|
216
|
-
for variable in required_variables:
|
|
217
|
-
if variable not in variables_data:
|
|
218
|
-
missing_variables.add(variable)
|
|
219
|
-
|
|
220
|
-
# If there are unknown env variables then we raise an error
|
|
221
|
-
if missing_variables:
|
|
222
|
-
raise ClickException(
|
|
223
|
-
"The following variables are used in environment definition but are not defined: {}".format(
|
|
224
|
-
", ".join(missing_variables)
|
|
225
|
-
)
|
|
226
|
-
)
|
|
227
|
-
|
|
228
|
-
# Look for cycles between variables
|
|
229
|
-
_check_for_cycles(variables_with_dependencies)
|
|
230
|
-
|
|
231
|
-
# Sort by number of dependencies
|
|
232
|
-
return sorted(
|
|
233
|
-
list(variables_with_dependencies.keys()),
|
|
234
|
-
key=lambda k: len(variables_with_dependencies[k]),
|
|
235
|
-
)
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
def _search_for_required_variables(variable_value: str):
|
|
239
|
-
"""
|
|
240
|
-
Look for pattern in variable value. Returns a list of env variables required
|
|
241
|
-
to expand this template.`
|
|
242
|
-
"""
|
|
243
|
-
ctx_env_prefix = f"{_CONTEXT_KEY}.env."
|
|
244
|
-
found_variables = re.findall(
|
|
245
|
-
rf"({_YML_TEMPLATE_START}([\.\w ]+){_YML_TEMPLATE_END})+", variable_value
|
|
246
|
-
)
|
|
247
|
-
required_variables = []
|
|
248
|
-
for _, variable in found_variables:
|
|
249
|
-
var: str = variable.strip()
|
|
250
|
-
if var.startswith(ctx_env_prefix):
|
|
251
|
-
required_variables.append(var[len(ctx_env_prefix) :])
|
|
252
|
-
return required_variables
|
|
253
|
-
|
|
254
|
-
|
|
255
126
|
def snowflake_sql_jinja_render(content: str, data: Dict | None = None) -> str:
|
|
256
127
|
data = data or {}
|
|
257
|
-
if
|
|
128
|
+
if CONTEXT_KEY in data:
|
|
258
129
|
raise ClickException(
|
|
259
|
-
f"{
|
|
130
|
+
f"{CONTEXT_KEY} in user defined data. The `{CONTEXT_KEY}` variable is reserved for CLI usage."
|
|
260
131
|
)
|
|
261
132
|
|
|
262
|
-
context_data =
|
|
263
|
-
project_definition=cli_context.project_definition
|
|
264
|
-
)
|
|
133
|
+
context_data = cli_context.template_context
|
|
265
134
|
context_data.update(data)
|
|
266
135
|
return get_sql_cli_jinja_env().from_string(content).render(**context_data)
|
snowflake/cli/api/utils/types.py
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
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
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
|
-
from typing import Any
|
|
17
|
+
from typing import Any, Dict
|
|
18
|
+
|
|
19
|
+
Context = Dict[str, Any]
|
|
20
|
+
Definition = Dict[str, Any]
|
|
4
21
|
|
|
5
22
|
|
|
6
23
|
def try_cast_to_bool(value: Any) -> bool:
|
snowflake/cli/app/__init__.py
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
import logging
|
|
2
16
|
import os
|
|
3
17
|
|
snowflake/cli/app/__main__.py
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
17
|
import sys
|
|
@@ -0,0 +1,13 @@
|
|
|
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.
|
|
@@ -0,0 +1,13 @@
|
|
|
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,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
17
|
from typing import List
|
snowflake/cli/app/cli_app.py
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
17
|
import logging
|
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from dataclasses import dataclass
|
|
2
16
|
|
|
3
17
|
from snowflake.cli.api.plugins.command import CommandSpec
|
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from snowflake.cli.plugins.connection import plugin_spec as connection_plugin_spec
|
|
2
16
|
from snowflake.cli.plugins.cortex import plugin_spec as cortex_plugin_spec
|
|
3
17
|
from snowflake.cli.plugins.git import plugin_spec as git_plugin_spec
|
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
17
|
import logging
|
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
17
|
from dataclasses import dataclass
|
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from logging import Logger
|
|
2
16
|
from typing import Callable
|
|
3
17
|
|
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
17
|
import threading
|
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
17
|
import logging
|
snowflake/cli/app/constants.py
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
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
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
17
|
from typing import Literal
|
|
4
18
|
|
|
5
19
|
PARAM_APPLICATION_NAME: Literal["snowcli"] = "snowcli"
|
|
6
|
-
PARAM_INTERNAL_APPLICATION_NAME: Literal["snowcli"] = "snowcli"
|
|
@@ -0,0 +1,13 @@
|
|
|
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,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
17
|
from dataclasses import dataclass, field
|
|
@@ -0,0 +1,13 @@
|
|
|
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,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
17
|
import logging
|
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
17
|
from typing import Optional
|
snowflake/cli/app/loggers.py
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
17
|
import logging
|
snowflake/cli/app/main_typer.py
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
17
|
import sys
|
snowflake/cli/app/printing.py
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
from __future__ import annotations
|
|
2
16
|
|
|
3
17
|
import json
|
|
@@ -28,6 +42,9 @@ NO_ITEMS_FOUND: str = "No data"
|
|
|
28
42
|
# ensure we do not break URLs that wrap lines
|
|
29
43
|
get_console().soft_wrap = True
|
|
30
44
|
|
|
45
|
+
# Disable markup to avoid escaping errors
|
|
46
|
+
get_console()._markup = False # noqa: SLF001
|
|
47
|
+
|
|
31
48
|
|
|
32
49
|
class CustomJSONEncoder(JSONEncoder):
|
|
33
50
|
"""Custom JSON encoder handling serialization of non-standard types"""
|