snowflake-cli 3.0.1__py3-none-any.whl → 3.0.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.
@@ -14,4 +14,4 @@
14
14
 
15
15
  from __future__ import annotations
16
16
 
17
- VERSION = "3.0.1"
17
+ VERSION = "3.0.2"
@@ -345,8 +345,6 @@ def build(
345
345
  skip_version_check=skip_version_check,
346
346
  pip_index_url=index_url,
347
347
  )
348
- if not download_result.succeeded:
349
- raise ClickException(download_result.error_message)
350
348
 
351
349
  log.info("Checking to see if packages have shared (.so/.dll) libraries...")
352
350
  if package_utils.detect_and_log_shared_libraries(
@@ -147,8 +147,6 @@ def package_create(
147
147
  skip_version_check=skip_version_check,
148
148
  pip_index_url=index_url,
149
149
  )
150
- if not download_result.succeeded:
151
- raise ClickException(download_result.error_message)
152
150
 
153
151
  # check if package was detected as available
154
152
  package_available_in_conda = any(
@@ -21,7 +21,6 @@ import os
21
21
  import re
22
22
  import subprocess
23
23
  from pathlib import Path
24
- from textwrap import dedent
25
24
  from typing import Dict, List, Optional
26
25
 
27
26
  from click import ClickException
@@ -97,6 +96,7 @@ def get_package_name_from_pip_wheel(package: str, index_url: str | None = None)
97
96
  download_dir=tmp_dir.path,
98
97
  index_url=index_url,
99
98
  dependencies=False,
99
+ raise_on_error=False,
100
100
  )
101
101
  file_list = [
102
102
  f.path.name for f in tmp_dir.iterdir() if f.path.name.endswith(".whl")
@@ -117,7 +117,6 @@ def _write_requirements_file(file_path: SecurePath, requirements: List[Requireme
117
117
 
118
118
  @dataclasses.dataclass
119
119
  class DownloadUnavailablePackagesResult:
120
- succeeded: bool
121
120
  error_message: str | None = None
122
121
  anaconda_packages: List[Requirement] = dataclasses.field(default_factory=list)
123
122
  downloaded_packages_details: List[RequirementWithFiles] = dataclasses.field(
@@ -151,8 +150,7 @@ def download_unavailable_packages(
151
150
  if not requirements:
152
151
  # all packages are available in Snowflake
153
152
  return DownloadUnavailablePackagesResult(
154
- succeeded=True,
155
- anaconda_packages=packages_in_snowflake,
153
+ anaconda_packages=packages_in_snowflake
156
154
  )
157
155
 
158
156
  # download all packages with their dependencies
@@ -160,19 +158,14 @@ def download_unavailable_packages(
160
158
  # This is a Windows workaround where use TemporaryDirectory instead of NamedTemporaryFile
161
159
  requirements_file = downloads_dir / "requirements.txt"
162
160
  _write_requirements_file(requirements_file, requirements) # type: ignore
163
- pip_wheel_result = pip_wheel(
161
+ pip_wheel(
164
162
  package_name=None,
165
163
  requirements_file=requirements_file.path, # type: ignore
166
164
  download_dir=downloads_dir.path,
167
165
  index_url=pip_index_url,
168
166
  dependencies=True,
167
+ raise_on_error=True,
169
168
  )
170
- if pip_wheel_result != 0:
171
- log.info(_pip_failed_log_msg(pip_wheel_result))
172
- return DownloadUnavailablePackagesResult(
173
- succeeded=False,
174
- error_message=_pip_failed_log_msg(pip_wheel_result),
175
- )
176
169
 
177
170
  # scan all downloaded packages and filter out ones available on Anaconda
178
171
  dependencies = split_downloaded_dependencies(
@@ -196,7 +189,6 @@ def download_unavailable_packages(
196
189
  for package in dependencies.unavailable_dependencies_wheels:
197
190
  package.extract_files(target_dir.path)
198
191
  return DownloadUnavailablePackagesResult(
199
- succeeded=True,
200
192
  anaconda_packages=packages_in_snowflake,
201
193
  downloaded_packages_details=[
202
194
  RequirementWithFiles(requirement=dep.requirement, files=dep.namelist())
@@ -211,7 +203,8 @@ def pip_wheel(
211
203
  download_dir: Path,
212
204
  index_url: Optional[str],
213
205
  dependencies: bool = True,
214
- ):
206
+ raise_on_error: bool = True,
207
+ ) -> int:
215
208
  command = ["-m", "pip", "wheel", "-w", str(download_dir)]
216
209
  if package_name:
217
210
  command.append(package_name)
@@ -222,23 +215,30 @@ def pip_wheel(
222
215
  if not dependencies:
223
216
  command.append("--no-deps")
224
217
 
225
- try:
218
+ log.info(
219
+ "Running pip wheel with command: %s",
220
+ " ".join([str(com) for com in command]),
221
+ )
222
+ result = subprocess.run(
223
+ ["python", *command],
224
+ capture_output=True,
225
+ text=True,
226
+ encoding=locale.getpreferredencoding(),
227
+ )
228
+ if result.returncode != 0:
226
229
  log.info(
227
- "Running pip wheel with command: %s",
228
- " ".join([str(com) for com in command]),
229
- )
230
- process = subprocess.run(
231
- ["python", *command],
232
- capture_output=True,
233
- text=True,
234
- encoding=locale.getpreferredencoding(),
230
+ "pip wheel finished with error code %d. Details: %s",
231
+ result.returncode,
232
+ result.stdout + result.stderr,
235
233
  )
236
- except subprocess.CalledProcessError as e:
237
- log.error("Encountered error %s", e.stderr)
238
- raise ClickException(f"Encountered error while running pip wheel.")
234
+ if raise_on_error:
235
+ raise ClickException(
236
+ f"pip wheel finished with error code {result.returncode}. Please re-run with --verbose or --debug for more details."
237
+ )
238
+ else:
239
+ log.info("pip wheel command executed successfully")
239
240
 
240
- log.info("Pip wheel command executed successfully")
241
- return process.returncode
241
+ return result.returncode
242
242
 
243
243
 
244
244
  @dataclasses.dataclass
@@ -341,14 +341,3 @@ def _log_dependencies_found_in_conda(available_dependencies: List[Requirement])
341
341
  )
342
342
  else:
343
343
  log.info("None of the package dependencies were found on Anaconda")
344
-
345
-
346
- def _pip_failed_log_msg(return_code: int) -> str:
347
- return dedent(
348
- f"""
349
- pip failed with return code {return_code}. Most likely reasons:
350
- * incorrect package name or version
351
- * package isn't compatible with host architecture (most probably due to .so libraries)
352
- * pip is not installed correctly
353
- """
354
- )
@@ -147,8 +147,11 @@ class UdfSprocIdentifier:
147
147
  self._arg_names, self._arg_types, self._arg_defaults
148
148
  ):
149
149
  s = f"{name} {_type}"
150
- if _default:
151
- if self._is_signature_type_a_string(_type):
150
+ if _default is not None:
151
+ if (
152
+ self._is_signature_type_a_string(_type)
153
+ and _default.lower() != "null"
154
+ ):
152
155
  _default = f"'{_default}'"
153
156
  s += f" default {_default}"
154
157
  sig.append(s)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: snowflake-cli
3
- Version: 3.0.1
3
+ Version: 3.0.2
4
4
  Summary: Snowflake CLI
5
5
  Project-URL: Source code, https://github.com/snowflakedb/snowflake-cli
6
6
  Project-URL: Bug Tracker, https://github.com/snowflakedb/snowflake-cli/issues
@@ -1,4 +1,4 @@
1
- snowflake/cli/__about__.py,sha256=nWr_fpmx2fCHU6Ao54JxjHG6igdmGVJl0mVCRPSvj9k,633
1
+ snowflake/cli/__about__.py,sha256=ykMwEnoJjghYCkU7YdCimhcQz_PMJ7Y93C1W_210oUU,633
2
2
  snowflake/cli/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
3
3
  snowflake/cli/_app/__init__.py,sha256=CR_uTgoqHnU1XdyRhm5iQsS86yWXGVx5Ht7aGSDNFmc,765
4
4
  snowflake/cli/_app/__main__.py,sha256=mHaHr0OsE2H_kUzNE3pu1znAr_stjXTZ4LAp7Hi2_po,834
@@ -101,19 +101,19 @@ snowflake/cli/_plugins/object/common.py,sha256=x1V8fiVnh7ohHHq0_NaGFtUvTz0soVRSG
101
101
  snowflake/cli/_plugins/object/manager.py,sha256=6PTd9GYVnF25WqdiOK7RiweouH9q4Hcf8t-x41PZ0CE,4870
102
102
  snowflake/cli/_plugins/object/plugin_spec.py,sha256=O8k6hSD48w4Uhkho0KpcTDkZ2iNjiU5jCPvEVitDzeo,995
103
103
  snowflake/cli/_plugins/snowpark/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
104
- snowflake/cli/_plugins/snowpark/commands.py,sha256=UTV7dz2x-lnjc3gj9d-vrLD9YTqow2LkIn9anffPrXc,16584
104
+ snowflake/cli/_plugins/snowpark/commands.py,sha256=fmr4mp7-d9Mfp_Y2pAYlQxHL_vG9Z-6hR9qIXkGBE5I,16470
105
105
  snowflake/cli/_plugins/snowpark/common.py,sha256=vpJNXPE8pnZiyu-2aPpZJY8sLtZhJERkbq1cuFq1CDA,9245
106
106
  snowflake/cli/_plugins/snowpark/models.py,sha256=Bd69O3krCS5HvQdHhjQsbhFi0wtYOD_Y9sj6lBMR7KU,4766
107
- snowflake/cli/_plugins/snowpark/package_utils.py,sha256=D7XhCa2XpFfYBdBDW5qA29ediATjus1w711r8rQgGJ4,12287
107
+ snowflake/cli/_plugins/snowpark/package_utils.py,sha256=GwCKgLTorCsO50UCPcuXy5voVjRSwmLxNFrONVrdtCs,11844
108
108
  snowflake/cli/_plugins/snowpark/plugin_spec.py,sha256=2fzlWnGL57oCLWfmkfo6USxvJpy7K9KPE3-ZqwILQcg,997
109
109
  snowflake/cli/_plugins/snowpark/snowpark_entity.py,sha256=Ly7tRfCB63eGEz9H7w-YoTuPMNS34JbMef0rQ8FC708,506
110
- snowflake/cli/_plugins/snowpark/snowpark_entity_model.py,sha256=M2QA6YtyA_XCk3s-KKO1vVBXQbdp4lPcE7NkMgNwUCw,6204
110
+ snowflake/cli/_plugins/snowpark/snowpark_entity_model.py,sha256=aaZqn5eKI6JfCZHTmQ2I9U2exnVIg2GsGf3fVMbp5_k,6307
111
111
  snowflake/cli/_plugins/snowpark/snowpark_project_paths.py,sha256=eGbnZVmI3uKO-OJQN4u2Gdk8nwoX3iDENwo-Nkk1U8M,3635
112
112
  snowflake/cli/_plugins/snowpark/snowpark_shared.py,sha256=bvKQa0FkB0UCoqIkxAJAYyymaXUuaiQ5hAe5m1GTXXk,1723
113
113
  snowflake/cli/_plugins/snowpark/zipper.py,sha256=us4MEtn0L8lWJvSiBVeA1xB_iLxGVG-c-31vutcGYqo,2430
114
114
  snowflake/cli/_plugins/snowpark/package/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
115
115
  snowflake/cli/_plugins/snowpark/package/anaconda_packages.py,sha256=KTgVTZCWSMtnTw3Mut9aL1_fj9XP0YTW_wNO7csb8XI,7808
116
- snowflake/cli/_plugins/snowpark/package/commands.py,sha256=i0kTEbXTfhI8PBP36u8lOuFBo_ThbRTbfJoI1aMKGmY,7096
116
+ snowflake/cli/_plugins/snowpark/package/commands.py,sha256=USqZE-5PAVpVO5NkwCXALF5oXLadaoc9b6O4guLdjCs,6990
117
117
  snowflake/cli/_plugins/snowpark/package/manager.py,sha256=sd-SQplvq7Y4mh3AKBGRCnndKn4ZEm6VVyZJllGJ9ro,1631
118
118
  snowflake/cli/_plugins/snowpark/package/utils.py,sha256=NEvKsK_kxKt_38GVOoiq8Mq4Aq6A67rrdf1tGdP6mK8,1012
119
119
  snowflake/cli/_plugins/spcs/__init__.py,sha256=WtfeiPqu_hLaMnc7twQRTs9Uy-207T8UpHWhEoJfRLY,1292
@@ -235,8 +235,8 @@ snowflake/cli/api/utils/naming_utils.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh
235
235
  snowflake/cli/api/utils/path_utils.py,sha256=ru0jgw6Ur5zhqpHhj_eAqcaJdrgEgr3bC7Z02FnQV18,1218
236
236
  snowflake/cli/api/utils/templating_functions.py,sha256=DlmpGAEY6OBArtIap6kN1aaILPwx2ynqKflPwjj7BbU,4935
237
237
  snowflake/cli/api/utils/types.py,sha256=fVKuls8axKSsBzPqWwrkwkwoXXmedqxNJKqfXrrGyBM,1190
238
- snowflake_cli-3.0.1.dist-info/METADATA,sha256=4bhhkbbocVu04yv5TB-dV1Y2aJzS3hLGWA6Fc0Hzd5I,17990
239
- snowflake_cli-3.0.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
240
- snowflake_cli-3.0.1.dist-info/entry_points.txt,sha256=6QmSI0wUX6p7f-dGvrPdswlQyVAVGi1AtOUbE8X6bho,58
241
- snowflake_cli-3.0.1.dist-info/licenses/LICENSE,sha256=mJMA3Uz2AbjU_kVggo1CAx01XhBsI7BSi2H7ggUg_-c,11344
242
- snowflake_cli-3.0.1.dist-info/RECORD,,
238
+ snowflake_cli-3.0.2.dist-info/METADATA,sha256=MYu_m_lWFiclD56oQacWMDR4jLEx_U_YzV5e9cJzBtQ,17990
239
+ snowflake_cli-3.0.2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
240
+ snowflake_cli-3.0.2.dist-info/entry_points.txt,sha256=6QmSI0wUX6p7f-dGvrPdswlQyVAVGi1AtOUbE8X6bho,58
241
+ snowflake_cli-3.0.2.dist-info/licenses/LICENSE,sha256=mJMA3Uz2AbjU_kVggo1CAx01XhBsI7BSi2H7ggUg_-c,11344
242
+ snowflake_cli-3.0.2.dist-info/RECORD,,