snowflake-connector-python 4.4.0__cp314-cp314-win_amd64.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.
Files changed (302) hide show
  1. snowflake/connector/__init__.py +118 -0
  2. snowflake/connector/_query_context_cache.py +276 -0
  3. snowflake/connector/_sql_util.py +48 -0
  4. snowflake/connector/_utils.py +353 -0
  5. snowflake/connector/aio/README.md +88 -0
  6. snowflake/connector/aio/__init__.py +163 -0
  7. snowflake/connector/aio/_azure_storage_client.py +227 -0
  8. snowflake/connector/aio/_bind_upload_agent.py +69 -0
  9. snowflake/connector/aio/_connection.py +1216 -0
  10. snowflake/connector/aio/_cursor.py +1402 -0
  11. snowflake/connector/aio/_description.py +5 -0
  12. snowflake/connector/aio/_direct_file_operation_utils.py +88 -0
  13. snowflake/connector/aio/_file_transfer_agent.py +316 -0
  14. snowflake/connector/aio/_gcs_storage_client.py +360 -0
  15. snowflake/connector/aio/_network.py +860 -0
  16. snowflake/connector/aio/_ocsp_asn1crypto.py +51 -0
  17. snowflake/connector/aio/_ocsp_snowflake.py +608 -0
  18. snowflake/connector/aio/_pandas_tools.py +561 -0
  19. snowflake/connector/aio/_result_batch.py +442 -0
  20. snowflake/connector/aio/_result_set.py +309 -0
  21. snowflake/connector/aio/_s3_storage_client.py +460 -0
  22. snowflake/connector/aio/_session_manager.py +588 -0
  23. snowflake/connector/aio/_storage_client.py +331 -0
  24. snowflake/connector/aio/_telemetry.py +97 -0
  25. snowflake/connector/aio/_time_util.py +57 -0
  26. snowflake/connector/aio/_wif_util.py +324 -0
  27. snowflake/connector/aio/auth/__init__.py +52 -0
  28. snowflake/connector/aio/auth/_auth.py +406 -0
  29. snowflake/connector/aio/auth/_by_plugin.py +131 -0
  30. snowflake/connector/aio/auth/_default.py +28 -0
  31. snowflake/connector/aio/auth/_idtoken.py +54 -0
  32. snowflake/connector/aio/auth/_keypair.py +60 -0
  33. snowflake/connector/aio/auth/_no_auth.py +31 -0
  34. snowflake/connector/aio/auth/_oauth.py +27 -0
  35. snowflake/connector/aio/auth/_oauth_code.py +117 -0
  36. snowflake/connector/aio/auth/_oauth_credentials.py +100 -0
  37. snowflake/connector/aio/auth/_okta.py +247 -0
  38. snowflake/connector/aio/auth/_pat.py +27 -0
  39. snowflake/connector/aio/auth/_usrpwdmfa.py +30 -0
  40. snowflake/connector/aio/auth/_webbrowser.py +405 -0
  41. snowflake/connector/aio/auth/_workload_identity.py +60 -0
  42. snowflake/connector/arrow_context.py +211 -0
  43. snowflake/connector/auth/__init__.py +53 -0
  44. snowflake/connector/auth/_auth.py +669 -0
  45. snowflake/connector/auth/_http_server.py +257 -0
  46. snowflake/connector/auth/_oauth_base.py +472 -0
  47. snowflake/connector/auth/by_plugin.py +219 -0
  48. snowflake/connector/auth/default.py +36 -0
  49. snowflake/connector/auth/idtoken.py +72 -0
  50. snowflake/connector/auth/keypair.py +225 -0
  51. snowflake/connector/auth/no_auth.py +39 -0
  52. snowflake/connector/auth/oauth.py +49 -0
  53. snowflake/connector/auth/oauth_code.py +490 -0
  54. snowflake/connector/auth/oauth_credentials.py +71 -0
  55. snowflake/connector/auth/okta.py +339 -0
  56. snowflake/connector/auth/pat.py +40 -0
  57. snowflake/connector/auth/usrpwdmfa.py +69 -0
  58. snowflake/connector/auth/webbrowser.py +514 -0
  59. snowflake/connector/auth/workload_identity.py +110 -0
  60. snowflake/connector/azure_storage_client.py +278 -0
  61. snowflake/connector/backoff_policies.py +141 -0
  62. snowflake/connector/bind_upload_agent.py +89 -0
  63. snowflake/connector/cache.py +696 -0
  64. snowflake/connector/compat.py +127 -0
  65. snowflake/connector/config_manager.py +553 -0
  66. snowflake/connector/connection.py +2671 -0
  67. snowflake/connector/connection_diagnostic.py +793 -0
  68. snowflake/connector/constants.py +460 -0
  69. snowflake/connector/converter.py +809 -0
  70. snowflake/connector/converter_issue23517.py +87 -0
  71. snowflake/connector/converter_null.py +14 -0
  72. snowflake/connector/converter_snowsql.py +205 -0
  73. snowflake/connector/crl.py +919 -0
  74. snowflake/connector/crl_cache.py +734 -0
  75. snowflake/connector/cursor.py +2099 -0
  76. snowflake/connector/dbapi.py +53 -0
  77. snowflake/connector/description.py +21 -0
  78. snowflake/connector/direct_file_operation_utils.py +88 -0
  79. snowflake/connector/encryption_util.py +220 -0
  80. snowflake/connector/errorcode.py +94 -0
  81. snowflake/connector/errors.py +666 -0
  82. snowflake/connector/externals_utils/__init__.py +0 -0
  83. snowflake/connector/externals_utils/externals_setup.py +30 -0
  84. snowflake/connector/feature.py +4 -0
  85. snowflake/connector/file_compression_type.py +118 -0
  86. snowflake/connector/file_lock.py +72 -0
  87. snowflake/connector/file_transfer_agent.py +1244 -0
  88. snowflake/connector/file_util.py +153 -0
  89. snowflake/connector/gcs_storage_client.py +476 -0
  90. snowflake/connector/gzip_decoder.py +85 -0
  91. snowflake/connector/interval_util.py +26 -0
  92. snowflake/connector/local_storage_client.py +90 -0
  93. snowflake/connector/log_configuration.py +62 -0
  94. snowflake/connector/logging_utils/__init__.py +0 -0
  95. snowflake/connector/logging_utils/filters.py +72 -0
  96. snowflake/connector/minicore/__init__.py +0 -0
  97. snowflake/connector/minicore/aix_ppc64/libsf_mini_core.a +0 -0
  98. snowflake/connector/minicore/aix_ppc64/libsf_mini_core_static.a +0 -0
  99. snowflake/connector/minicore/linux_aarch64_glibc/libsf_mini_core.so +0 -0
  100. snowflake/connector/minicore/linux_aarch64_musl/libsf_mini_core.so +0 -0
  101. snowflake/connector/minicore/linux_x86_64_glibc/libsf_mini_core.so +0 -0
  102. snowflake/connector/minicore/linux_x86_64_musl/libsf_mini_core.so +0 -0
  103. snowflake/connector/minicore/macos_aarch64/libsf_mini_core.dylib +0 -0
  104. snowflake/connector/minicore/macos_x86_64/libsf_mini_core.dylib +0 -0
  105. snowflake/connector/minicore/windows_x86_64/sf_mini_core.dll +0 -0
  106. snowflake/connector/minicore/windows_x86_64/sf_mini_core_static.lib +0 -0
  107. snowflake/connector/nanoarrow_arrow_iterator.cp314-win_amd64.pyd +0 -0
  108. snowflake/connector/nanoarrow_cpp/ArrowIterator/ArrayConverter.cpp +60 -0
  109. snowflake/connector/nanoarrow_cpp/ArrowIterator/ArrayConverter.hpp +29 -0
  110. snowflake/connector/nanoarrow_cpp/ArrowIterator/BinaryConverter.cpp +19 -0
  111. snowflake/connector/nanoarrow_cpp/ArrowIterator/BinaryConverter.hpp +26 -0
  112. snowflake/connector/nanoarrow_cpp/ArrowIterator/BooleanConverter.cpp +21 -0
  113. snowflake/connector/nanoarrow_cpp/ArrowIterator/BooleanConverter.hpp +23 -0
  114. snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowChunkIterator.cpp +570 -0
  115. snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowChunkIterator.hpp +98 -0
  116. snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowIterator.cpp +125 -0
  117. snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowIterator.hpp +115 -0
  118. snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowTableIterator.cpp +1140 -0
  119. snowflake/connector/nanoarrow_cpp/ArrowIterator/CArrowTableIterator.hpp +138 -0
  120. snowflake/connector/nanoarrow_cpp/ArrowIterator/DateConverter.cpp +47 -0
  121. snowflake/connector/nanoarrow_cpp/ArrowIterator/DateConverter.hpp +46 -0
  122. snowflake/connector/nanoarrow_cpp/ArrowIterator/DecFloatConverter.cpp +83 -0
  123. snowflake/connector/nanoarrow_cpp/ArrowIterator/DecFloatConverter.hpp +35 -0
  124. snowflake/connector/nanoarrow_cpp/ArrowIterator/DecimalConverter.cpp +97 -0
  125. snowflake/connector/nanoarrow_cpp/ArrowIterator/DecimalConverter.hpp +72 -0
  126. snowflake/connector/nanoarrow_cpp/ArrowIterator/FixedSizeListConverter.cpp +73 -0
  127. snowflake/connector/nanoarrow_cpp/ArrowIterator/FixedSizeListConverter.hpp +28 -0
  128. snowflake/connector/nanoarrow_cpp/ArrowIterator/FloatConverter.cpp +30 -0
  129. snowflake/connector/nanoarrow_cpp/ArrowIterator/FloatConverter.hpp +35 -0
  130. snowflake/connector/nanoarrow_cpp/ArrowIterator/IColumnConverter.hpp +17 -0
  131. snowflake/connector/nanoarrow_cpp/ArrowIterator/IntConverter.cpp +23 -0
  132. snowflake/connector/nanoarrow_cpp/ArrowIterator/IntConverter.hpp +45 -0
  133. snowflake/connector/nanoarrow_cpp/ArrowIterator/IntervalConverter.cpp +75 -0
  134. snowflake/connector/nanoarrow_cpp/ArrowIterator/IntervalConverter.hpp +57 -0
  135. snowflake/connector/nanoarrow_cpp/ArrowIterator/LICENSE.txt +209 -0
  136. snowflake/connector/nanoarrow_cpp/ArrowIterator/MapConverter.cpp +75 -0
  137. snowflake/connector/nanoarrow_cpp/ArrowIterator/MapConverter.hpp +30 -0
  138. snowflake/connector/nanoarrow_cpp/ArrowIterator/ObjectConverter.cpp +46 -0
  139. snowflake/connector/nanoarrow_cpp/ArrowIterator/ObjectConverter.hpp +29 -0
  140. snowflake/connector/nanoarrow_cpp/ArrowIterator/Python/Common.cpp +8 -0
  141. snowflake/connector/nanoarrow_cpp/ArrowIterator/Python/Common.hpp +95 -0
  142. snowflake/connector/nanoarrow_cpp/ArrowIterator/Python/Helpers.cpp +57 -0
  143. snowflake/connector/nanoarrow_cpp/ArrowIterator/Python/Helpers.hpp +36 -0
  144. snowflake/connector/nanoarrow_cpp/ArrowIterator/SnowflakeType.cpp +34 -0
  145. snowflake/connector/nanoarrow_cpp/ArrowIterator/SnowflakeType.hpp +48 -0
  146. snowflake/connector/nanoarrow_cpp/ArrowIterator/StringConverter.cpp +19 -0
  147. snowflake/connector/nanoarrow_cpp/ArrowIterator/StringConverter.hpp +26 -0
  148. snowflake/connector/nanoarrow_cpp/ArrowIterator/TimeConverter.cpp +36 -0
  149. snowflake/connector/nanoarrow_cpp/ArrowIterator/TimeConverter.hpp +31 -0
  150. snowflake/connector/nanoarrow_cpp/ArrowIterator/TimeStampConverter.cpp +346 -0
  151. snowflake/connector/nanoarrow_cpp/ArrowIterator/TimeStampConverter.hpp +145 -0
  152. snowflake/connector/nanoarrow_cpp/ArrowIterator/Util/macros.hpp +14 -0
  153. snowflake/connector/nanoarrow_cpp/ArrowIterator/Util/time.cpp +67 -0
  154. snowflake/connector/nanoarrow_cpp/ArrowIterator/Util/time.hpp +68 -0
  155. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_accessors.h +101 -0
  156. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_alloc.h +127 -0
  157. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_assert.h +45 -0
  158. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_builder.h +1908 -0
  159. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_emitter.h +215 -0
  160. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_endian.h +125 -0
  161. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_epilogue.h +7 -0
  162. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_flatbuffers.h +55 -0
  163. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_identifier.h +148 -0
  164. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_iov.h +31 -0
  165. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_prologue.h +8 -0
  166. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_refmap.h +144 -0
  167. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_rtconfig.h +162 -0
  168. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_types.h +97 -0
  169. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/flatcc_verifier.h +239 -0
  170. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/flatcc_portable.h +14 -0
  171. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/paligned_alloc.h +210 -0
  172. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pattributes.h +84 -0
  173. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pdiagnostic.h +84 -0
  174. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pdiagnostic_pop.h +20 -0
  175. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pdiagnostic_push.h +51 -0
  176. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pendian.h +206 -0
  177. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pendian_detect.h +118 -0
  178. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pinline.h +19 -0
  179. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pinttypes.h +52 -0
  180. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/portable.h +2 -0
  181. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/portable_basic.h +25 -0
  182. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pstatic_assert.h +67 -0
  183. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pstdalign.h +162 -0
  184. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pstdint.h +898 -0
  185. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/punaligned.h +190 -0
  186. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pversion.h +6 -0
  187. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc/portable/pwarnings.h +52 -0
  188. snowflake/connector/nanoarrow_cpp/ArrowIterator/flatcc.c +3204 -0
  189. snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow.c +3217 -0
  190. snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow.h +3618 -0
  191. snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow.hpp +379 -0
  192. snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_arrow_iterator.pyx +262 -0
  193. snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_device.c +512 -0
  194. snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_device.h +350 -0
  195. snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_ipc.c +33273 -0
  196. snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_ipc.h +397 -0
  197. snowflake/connector/nanoarrow_cpp/Logging/logging.cpp +100 -0
  198. snowflake/connector/nanoarrow_cpp/Logging/logging.hpp +49 -0
  199. snowflake/connector/network.py +1227 -0
  200. snowflake/connector/ocsp_asn1crypto.py +447 -0
  201. snowflake/connector/ocsp_snowflake.py +1939 -0
  202. snowflake/connector/options.py +179 -0
  203. snowflake/connector/os_details.py +88 -0
  204. snowflake/connector/pandas_tools.py +734 -0
  205. snowflake/connector/platform_detection.py +555 -0
  206. snowflake/connector/proxy.py +28 -0
  207. snowflake/connector/py.typed +0 -0
  208. snowflake/connector/result_batch.py +917 -0
  209. snowflake/connector/result_set.py +340 -0
  210. snowflake/connector/s3_storage_client.py +614 -0
  211. snowflake/connector/secret_detector.py +181 -0
  212. snowflake/connector/session_manager.py +650 -0
  213. snowflake/connector/sf_dirs.py +64 -0
  214. snowflake/connector/sfbinaryformat.py +35 -0
  215. snowflake/connector/sfdatetime.py +345 -0
  216. snowflake/connector/snow_logging.py +144 -0
  217. snowflake/connector/sqlstate.py +9 -0
  218. snowflake/connector/ssd_internal_keys.py +30 -0
  219. snowflake/connector/ssl_wrap_socket.py +281 -0
  220. snowflake/connector/storage_client.py +486 -0
  221. snowflake/connector/telemetry.py +254 -0
  222. snowflake/connector/telemetry_oob.py +544 -0
  223. snowflake/connector/test_util.py +30 -0
  224. snowflake/connector/time_util.py +159 -0
  225. snowflake/connector/token_cache.py +457 -0
  226. snowflake/connector/tool/__init__.py +0 -0
  227. snowflake/connector/tool/dump_certs.py +57 -0
  228. snowflake/connector/tool/dump_ocsp_response.py +139 -0
  229. snowflake/connector/tool/dump_ocsp_response_cache.py +194 -0
  230. snowflake/connector/tool/probe_connection.py +69 -0
  231. snowflake/connector/url_util.py +55 -0
  232. snowflake/connector/util_text.py +320 -0
  233. snowflake/connector/vendored/__init__.py +3 -0
  234. snowflake/connector/vendored/requests/LICENSE +175 -0
  235. snowflake/connector/vendored/requests/__init__.py +184 -0
  236. snowflake/connector/vendored/requests/__version__.py +14 -0
  237. snowflake/connector/vendored/requests/_internal_utils.py +50 -0
  238. snowflake/connector/vendored/requests/adapters.py +696 -0
  239. snowflake/connector/vendored/requests/api.py +157 -0
  240. snowflake/connector/vendored/requests/auth.py +314 -0
  241. snowflake/connector/vendored/requests/certs.py +17 -0
  242. snowflake/connector/vendored/requests/compat.py +106 -0
  243. snowflake/connector/vendored/requests/cookies.py +561 -0
  244. snowflake/connector/vendored/requests/exceptions.py +151 -0
  245. snowflake/connector/vendored/requests/help.py +134 -0
  246. snowflake/connector/vendored/requests/hooks.py +33 -0
  247. snowflake/connector/vendored/requests/models.py +1039 -0
  248. snowflake/connector/vendored/requests/packages.py +23 -0
  249. snowflake/connector/vendored/requests/sessions.py +831 -0
  250. snowflake/connector/vendored/requests/status_codes.py +128 -0
  251. snowflake/connector/vendored/requests/structures.py +99 -0
  252. snowflake/connector/vendored/requests/utils.py +1086 -0
  253. snowflake/connector/vendored/urllib3/LICENSE.txt +21 -0
  254. snowflake/connector/vendored/urllib3/__init__.py +211 -0
  255. snowflake/connector/vendored/urllib3/_base_connection.py +165 -0
  256. snowflake/connector/vendored/urllib3/_collections.py +487 -0
  257. snowflake/connector/vendored/urllib3/_request_methods.py +278 -0
  258. snowflake/connector/vendored/urllib3/_version.py +34 -0
  259. snowflake/connector/vendored/urllib3/connection.py +1108 -0
  260. snowflake/connector/vendored/urllib3/connectionpool.py +1178 -0
  261. snowflake/connector/vendored/urllib3/contrib/__init__.py +0 -0
  262. snowflake/connector/vendored/urllib3/contrib/emscripten/__init__.py +17 -0
  263. snowflake/connector/vendored/urllib3/contrib/emscripten/connection.py +260 -0
  264. snowflake/connector/vendored/urllib3/contrib/emscripten/emscripten_fetch_worker.js +110 -0
  265. snowflake/connector/vendored/urllib3/contrib/emscripten/fetch.py +726 -0
  266. snowflake/connector/vendored/urllib3/contrib/emscripten/request.py +22 -0
  267. snowflake/connector/vendored/urllib3/contrib/emscripten/response.py +277 -0
  268. snowflake/connector/vendored/urllib3/contrib/pyopenssl.py +564 -0
  269. snowflake/connector/vendored/urllib3/contrib/socks.py +228 -0
  270. snowflake/connector/vendored/urllib3/exceptions.py +335 -0
  271. snowflake/connector/vendored/urllib3/fields.py +341 -0
  272. snowflake/connector/vendored/urllib3/filepost.py +89 -0
  273. snowflake/connector/vendored/urllib3/http2/__init__.py +53 -0
  274. snowflake/connector/vendored/urllib3/http2/connection.py +356 -0
  275. snowflake/connector/vendored/urllib3/http2/probe.py +87 -0
  276. snowflake/connector/vendored/urllib3/poolmanager.py +651 -0
  277. snowflake/connector/vendored/urllib3/py.typed +2 -0
  278. snowflake/connector/vendored/urllib3/response.py +1480 -0
  279. snowflake/connector/vendored/urllib3/util/__init__.py +42 -0
  280. snowflake/connector/vendored/urllib3/util/connection.py +137 -0
  281. snowflake/connector/vendored/urllib3/util/proxy.py +43 -0
  282. snowflake/connector/vendored/urllib3/util/request.py +263 -0
  283. snowflake/connector/vendored/urllib3/util/response.py +101 -0
  284. snowflake/connector/vendored/urllib3/util/retry.py +549 -0
  285. snowflake/connector/vendored/urllib3/util/ssl_.py +527 -0
  286. snowflake/connector/vendored/urllib3/util/ssl_match_hostname.py +159 -0
  287. snowflake/connector/vendored/urllib3/util/ssltransport.py +271 -0
  288. snowflake/connector/vendored/urllib3/util/timeout.py +275 -0
  289. snowflake/connector/vendored/urllib3/util/url.py +469 -0
  290. snowflake/connector/vendored/urllib3/util/util.py +42 -0
  291. snowflake/connector/vendored/urllib3/util/wait.py +124 -0
  292. snowflake/connector/version.py +3 -0
  293. snowflake/connector/wif_util.py +434 -0
  294. snowflake_connector_python-4.4.0.dist-info/DELVEWHEEL +2 -0
  295. snowflake_connector_python-4.4.0.dist-info/METADATA +1591 -0
  296. snowflake_connector_python-4.4.0.dist-info/RECORD +302 -0
  297. snowflake_connector_python-4.4.0.dist-info/WHEEL +5 -0
  298. snowflake_connector_python-4.4.0.dist-info/entry_points.txt +4 -0
  299. snowflake_connector_python-4.4.0.dist-info/licenses/LICENSE.txt +202 -0
  300. snowflake_connector_python-4.4.0.dist-info/licenses/NOTICE +8 -0
  301. snowflake_connector_python-4.4.0.dist-info/top_level.txt +1 -0
  302. snowflake_connector_python.libs/msvcp140-0f885b509a685d2bbfa652fed26b5fb3.dll +0 -0
@@ -0,0 +1,460 @@
1
+ #!/usr/bin/env python
2
+ from __future__ import annotations
3
+
4
+ from collections import defaultdict
5
+ from enum import Enum, auto, unique
6
+ from typing import TYPE_CHECKING, Any, Callable, DefaultDict, NamedTuple
7
+
8
+ from .options import pyarrow as pa
9
+ from .sf_dirs import _resolve_platform_dirs
10
+
11
+ if TYPE_CHECKING:
12
+ from pyarrow import DataType
13
+
14
+ from .cursor import ResultMetadataV2
15
+
16
+ # Snowflake's central platform dependent directories, if the folder
17
+ # ~/.snowflake/ (customizable by the environment variable SNOWFLAKE_HOME) exists
18
+ # we use that folder for everything. Otherwise, we fall back to platformdirs
19
+ # defaults. Please see comments in sf_dir.py for more information.
20
+ DIRS = _resolve_platform_dirs()
21
+
22
+ # Snowflake's configuration files. By default, platformdirs will resolve
23
+ # them to these places depending on OS:
24
+ # * Linux: `~/.config/snowflake/filename` but can be updated with XDG vars
25
+ # * Windows: `%USERPROFILE%\AppData\Local\snowflake\filename`
26
+ # * Mac: `~/Library/Application Support/snowflake/filename`
27
+ CONNECTIONS_FILE = DIRS.user_config_path / "connections.toml"
28
+ CONFIG_FILE = DIRS.user_config_path / "config.toml"
29
+
30
+ DBAPI_TYPE_STRING = 0
31
+ DBAPI_TYPE_BINARY = 1
32
+ DBAPI_TYPE_NUMBER = 2
33
+ DBAPI_TYPE_TIMESTAMP = 3
34
+
35
+ _DEFAULT_HOSTNAME_TLD = "com"
36
+ _CHINA_HOSTNAME_TLD = "cn"
37
+ _TOP_LEVEL_DOMAIN_REGEX = r"\.[a-zA-Z]{1,63}$"
38
+ _SNOWFLAKE_HOST_SUFFIX_REGEX = r"snowflakecomputing(\.[a-zA-Z]{1,63}){1,2}$"
39
+
40
+ _PARAM_USE_SCOPED_TEMP_FOR_PANDAS_TOOLS = "ENABLE_FIX_1375538"
41
+
42
+
43
+ class FieldType(NamedTuple):
44
+ name: str
45
+ dbapi_type: list[int]
46
+ pa_type: Callable[[ResultMetadataV2], DataType]
47
+
48
+
49
+ def vector_pa_type(metadata: ResultMetadataV2) -> DataType:
50
+ """
51
+ Generate the Arrow type represented by the given vector column metadata.
52
+ Vectors are represented as Arrow fixed-size lists.
53
+ """
54
+ assert (
55
+ metadata.fields is not None and len(metadata.fields) == 1
56
+ ), "Invalid result metadata for vector type: expected a single field to be defined"
57
+ assert (
58
+ metadata.vector_dimension or 0
59
+ ) > 0, "Invalid result metadata for vector type: expected a positive dimension"
60
+
61
+ field_type = FIELD_TYPES[metadata.fields[0].type_code]
62
+ return pa.list_(field_type.pa_type(metadata.fields[0]), metadata.vector_dimension)
63
+
64
+
65
+ def array_pa_type(metadata: ResultMetadataV2) -> DataType:
66
+ """
67
+ Generate the Arrow type represented by the given array column metadata.
68
+ """
69
+ # If fields is missing then structured types are not enabled.
70
+ # Fallback to json encoded string
71
+ if metadata.fields is None:
72
+ return pa.string()
73
+
74
+ assert (
75
+ len(metadata.fields) == 1
76
+ ), "Invalid result metadata for array type: expected a single field to be defined"
77
+
78
+ field_type = FIELD_TYPES[metadata.fields[0].type_code]
79
+ return pa.list_(field_type.pa_type(metadata.fields[0]))
80
+
81
+
82
+ def map_pa_type(metadata: ResultMetadataV2) -> DataType:
83
+ """
84
+ Generate the Arrow type represented by the given map column metadata.
85
+ """
86
+ # If fields is missing then structured types are not enabled.
87
+ # Fallback to json encoded string
88
+ if metadata.fields is None:
89
+ return pa.string()
90
+
91
+ assert (
92
+ len(metadata.fields or []) == 2
93
+ ), "Invalid result metadata for map type: expected a field for key and a field for value"
94
+ key_type = FIELD_TYPES[metadata.fields[0].type_code]
95
+ value_type = FIELD_TYPES[metadata.fields[1].type_code]
96
+ return pa.map_(
97
+ key_type.pa_type(metadata.fields[0]), value_type.pa_type(metadata.fields[1])
98
+ )
99
+
100
+
101
+ def struct_pa_type(metadata: ResultMetadataV2) -> DataType:
102
+ """
103
+ Generate the Arrow type represented by the given struct column metadata.
104
+ """
105
+ # If fields is missing then structured types are not enabled.
106
+ # Fallback to json encoded string
107
+ if metadata.fields is None:
108
+ return pa.string()
109
+
110
+ assert all(
111
+ field.name is not None for field in metadata.fields
112
+ ), "All fields of a stuct type must have a name."
113
+ return pa.struct(
114
+ {
115
+ field.name: FIELD_TYPES[field.type_code].pa_type(field)
116
+ for field in metadata.fields
117
+ }
118
+ )
119
+
120
+
121
+ # This type mapping holds column type definitions.
122
+ # Be careful to not change the ordering as the index is what Snowflake
123
+ # gives to as schema
124
+ #
125
+ # `name` is the SQL name of the type, `dbapi_type` is the set of corresponding
126
+ # PEP 249 type objects, and `pa_type` is a lambda that takes in a column's
127
+ # result metadata and returns the corresponding Arrow type.
128
+ FIELD_TYPES: tuple[FieldType, ...] = (
129
+ FieldType(
130
+ name="FIXED", dbapi_type=[DBAPI_TYPE_NUMBER], pa_type=lambda _: pa.int64()
131
+ ),
132
+ FieldType(
133
+ name="REAL", dbapi_type=[DBAPI_TYPE_NUMBER], pa_type=lambda _: pa.float64()
134
+ ),
135
+ FieldType(
136
+ name="TEXT", dbapi_type=[DBAPI_TYPE_STRING], pa_type=lambda _: pa.string()
137
+ ),
138
+ FieldType(
139
+ name="DATE", dbapi_type=[DBAPI_TYPE_TIMESTAMP], pa_type=lambda _: pa.date64()
140
+ ),
141
+ FieldType(
142
+ name="TIMESTAMP",
143
+ dbapi_type=[DBAPI_TYPE_TIMESTAMP],
144
+ pa_type=lambda _: pa.time64("ns"),
145
+ ),
146
+ FieldType(
147
+ name="VARIANT", dbapi_type=[DBAPI_TYPE_BINARY], pa_type=lambda _: pa.string()
148
+ ),
149
+ FieldType(
150
+ name="TIMESTAMP_LTZ",
151
+ dbapi_type=[DBAPI_TYPE_TIMESTAMP],
152
+ pa_type=lambda _: pa.timestamp("ns"),
153
+ ),
154
+ FieldType(
155
+ name="TIMESTAMP_TZ",
156
+ dbapi_type=[DBAPI_TYPE_TIMESTAMP],
157
+ pa_type=lambda _: pa.timestamp("ns"),
158
+ ),
159
+ FieldType(
160
+ name="TIMESTAMP_NTZ",
161
+ dbapi_type=[DBAPI_TYPE_TIMESTAMP],
162
+ pa_type=lambda _: pa.timestamp("ns"),
163
+ ),
164
+ FieldType(name="OBJECT", dbapi_type=[DBAPI_TYPE_BINARY], pa_type=struct_pa_type),
165
+ FieldType(name="ARRAY", dbapi_type=[DBAPI_TYPE_BINARY], pa_type=array_pa_type),
166
+ FieldType(
167
+ name="BINARY", dbapi_type=[DBAPI_TYPE_BINARY], pa_type=lambda _: pa.binary()
168
+ ),
169
+ FieldType(
170
+ name="TIME",
171
+ dbapi_type=[DBAPI_TYPE_TIMESTAMP],
172
+ pa_type=lambda _: pa.time64("ns"),
173
+ ),
174
+ FieldType(name="BOOLEAN", dbapi_type=[], pa_type=lambda _: pa.bool_()),
175
+ FieldType(
176
+ name="GEOGRAPHY", dbapi_type=[DBAPI_TYPE_STRING], pa_type=lambda _: pa.string()
177
+ ),
178
+ FieldType(
179
+ name="GEOMETRY", dbapi_type=[DBAPI_TYPE_STRING], pa_type=lambda _: pa.string()
180
+ ),
181
+ FieldType(name="VECTOR", dbapi_type=[DBAPI_TYPE_BINARY], pa_type=vector_pa_type),
182
+ FieldType(name="MAP", dbapi_type=[DBAPI_TYPE_BINARY], pa_type=map_pa_type),
183
+ FieldType(
184
+ name="FILE", dbapi_type=[DBAPI_TYPE_STRING], pa_type=lambda _: pa.string()
185
+ ),
186
+ FieldType(
187
+ name="INTERVAL_YEAR_MONTH",
188
+ dbapi_type=[DBAPI_TYPE_NUMBER],
189
+ pa_type=lambda _: pa.int64(),
190
+ ),
191
+ FieldType(
192
+ name="INTERVAL_DAY_TIME",
193
+ dbapi_type=[DBAPI_TYPE_NUMBER],
194
+ pa_type=lambda _: pa.int64(),
195
+ ),
196
+ )
197
+
198
+ FIELD_NAME_TO_ID: DefaultDict[Any, int] = defaultdict(int)
199
+ FIELD_ID_TO_NAME: DefaultDict[int, str] = defaultdict(str)
200
+
201
+ __binary_types: list[int] = []
202
+ __binary_type_names: list[str] = []
203
+ __string_types: list[int] = []
204
+ __string_type_names: list[str] = []
205
+ __number_types: list[int] = []
206
+ __number_type_names: list[str] = []
207
+ __timestamp_types: list[int] = []
208
+ __timestamp_type_names: list[str] = []
209
+
210
+ for idx, field_type in enumerate(FIELD_TYPES):
211
+ FIELD_ID_TO_NAME[idx] = field_type.name
212
+ FIELD_NAME_TO_ID[field_type.name] = idx
213
+
214
+ dbapi_types = field_type.dbapi_type
215
+ for dbapi_type in dbapi_types:
216
+ if dbapi_type == DBAPI_TYPE_BINARY:
217
+ __binary_types.append(idx)
218
+ __binary_type_names.append(field_type.name)
219
+ elif dbapi_type == DBAPI_TYPE_TIMESTAMP:
220
+ __timestamp_types.append(idx)
221
+ __timestamp_type_names.append(field_type.name)
222
+ elif dbapi_type == DBAPI_TYPE_NUMBER:
223
+ __number_types.append(idx)
224
+ __number_type_names.append(field_type.name)
225
+ elif dbapi_type == DBAPI_TYPE_STRING:
226
+ __string_types.append(idx)
227
+ __string_type_names.append(field_type.name)
228
+
229
+
230
+ def get_binary_types() -> list[int]:
231
+ return __binary_types
232
+
233
+
234
+ def is_binary_type_name(type_name: str) -> bool:
235
+ return type_name in __binary_type_names
236
+
237
+
238
+ def get_string_types() -> list[int]:
239
+ return __string_types
240
+
241
+
242
+ def is_string_type_name(type_name) -> bool:
243
+ return type_name in __string_type_names
244
+
245
+
246
+ def get_number_types() -> list[int]:
247
+ return __number_types
248
+
249
+
250
+ def is_number_type_name(type_name) -> bool:
251
+ return type_name in __number_type_names
252
+
253
+
254
+ def get_timestamp_types() -> list[int]:
255
+ return __timestamp_types
256
+
257
+
258
+ def is_timestamp_type_name(type_name) -> bool:
259
+ return type_name in __timestamp_type_names
260
+
261
+
262
+ def is_date_type_name(type_name) -> bool:
263
+ return type_name == "DATE"
264
+
265
+
266
+ # Log format
267
+ LOG_FORMAT = (
268
+ "%(asctime)s - %(filename)s:%(lineno)d - "
269
+ "%(funcName)s() - %(levelname)s - %(message)s"
270
+ )
271
+
272
+ # String literals
273
+ UTF8 = "utf-8"
274
+ SHA256_DIGEST = "sha256_digest"
275
+
276
+ # PUT/GET related
277
+ S3_FS = "S3"
278
+ AZURE_FS = "AZURE"
279
+ GCS_FS = "GCS"
280
+ LOCAL_FS = "LOCAL_FS"
281
+ CMD_TYPE_UPLOAD = "UPLOAD"
282
+ CMD_TYPE_DOWNLOAD = "DOWNLOAD"
283
+ FILE_PROTOCOL = "file://"
284
+
285
+
286
+ @unique
287
+ class ResultStatus(Enum):
288
+ ERROR = "ERROR"
289
+ SUCCEEDED = "SUCCEEDED"
290
+ UPLOADED = "UPLOADED"
291
+ DOWNLOADED = "DOWNLOADED"
292
+ COLLISION = "COLLISION"
293
+ SKIPPED = "SKIPPED"
294
+ RENEW_TOKEN = "RENEW_TOKEN"
295
+ RENEW_PRESIGNED_URL = "RENEW_PRESIGNED_URL"
296
+ NOT_FOUND_FILE = "NOT_FOUND_FILE"
297
+ NEED_RETRY = "NEED_RETRY"
298
+ NEED_RETRY_WITH_LOWER_CONCURRENCY = "NEED_RETRY_WITH_LOWER_CONCURRENCY"
299
+
300
+
301
+ class SnowflakeS3FileEncryptionMaterial(NamedTuple):
302
+ query_id: str
303
+ query_stage_master_key: str
304
+ smk_id: int
305
+
306
+
307
+ class MaterialDescriptor(NamedTuple):
308
+ smk_id: int
309
+ query_id: str
310
+ key_size: int
311
+
312
+
313
+ class EncryptionMetadata(NamedTuple):
314
+ key: str
315
+ iv: str
316
+ matdesc: str
317
+
318
+
319
+ class FileHeader(NamedTuple):
320
+ digest: str | None
321
+ content_length: int | None
322
+ encryption_metadata: EncryptionMetadata | None
323
+
324
+
325
+ PARAMETER_AUTOCOMMIT = "AUTOCOMMIT"
326
+ PARAMETER_CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY = (
327
+ "CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY"
328
+ )
329
+ PARAMETER_CLIENT_SESSION_KEEP_ALIVE = "CLIENT_SESSION_KEEP_ALIVE"
330
+ PARAMETER_CLIENT_PREFETCH_THREADS = "CLIENT_PREFETCH_THREADS"
331
+ PARAMETER_CLIENT_TELEMETRY_ENABLED = "CLIENT_TELEMETRY_ENABLED"
332
+ PARAMETER_CLIENT_TELEMETRY_OOB_ENABLED = "CLIENT_OUT_OF_BAND_TELEMETRY_ENABLED"
333
+ PARAMETER_CLIENT_STORE_TEMPORARY_CREDENTIAL = "CLIENT_STORE_TEMPORARY_CREDENTIAL"
334
+ PARAMETER_CLIENT_REQUEST_MFA_TOKEN = "CLIENT_REQUEST_MFA_TOKEN"
335
+ PARAMETER_CLIENT_USE_SECURE_STORAGE_FOR_TEMPORARY_CREDENTIAL = (
336
+ "CLIENT_USE_SECURE_STORAGE_FOR_TEMPORARY_CREDENTIAL"
337
+ )
338
+ PARAMETER_QUERY_CONTEXT_CACHE_SIZE = "QUERY_CONTEXT_CACHE_SIZE"
339
+ PARAMETER_TIMEZONE = "TIMEZONE"
340
+ PARAMETER_SERVICE_NAME = "SERVICE_NAME"
341
+ PARAMETER_CLIENT_VALIDATE_DEFAULT_PARAMETERS = "CLIENT_VALIDATE_DEFAULT_PARAMETERS"
342
+ PARAMETER_PYTHON_CONNECTOR_QUERY_RESULT_FORMAT = "PYTHON_CONNECTOR_QUERY_RESULT_FORMAT"
343
+ PARAMETER_ENABLE_STAGE_S3_PRIVATELINK_FOR_US_EAST_1 = (
344
+ "ENABLE_STAGE_S3_PRIVATELINK_FOR_US_EAST_1"
345
+ )
346
+ PARAMETER_MULTI_STATEMENT_COUNT = "MULTI_STATEMENT_COUNT"
347
+
348
+ HTTP_HEADER_CONTENT_TYPE = "Content-Type"
349
+ HTTP_HEADER_CONTENT_ENCODING = "Content-Encoding"
350
+ HTTP_HEADER_ACCEPT_ENCODING = "Accept-Encoding"
351
+ HTTP_HEADER_ACCEPT = "accept"
352
+ HTTP_HEADER_USER_AGENT = "User-Agent"
353
+ HTTP_HEADER_SERVICE_NAME = "X-Snowflake-Service"
354
+
355
+ HTTP_HEADER_VALUE_OCTET_STREAM = "application/octet-stream"
356
+
357
+ # OCSP
358
+ OCSP_ROOT_CERTS_DICT_LOCK_TIMEOUT_DEFAULT_NO_TIMEOUT: int = -1
359
+
360
+
361
+ @unique
362
+ class OCSPMode(Enum):
363
+ """OCSP Mode enumerator for all the available modes.
364
+
365
+ OCSP mode descriptions:
366
+ FAIL_CLOSED: If the client or driver does not receive a valid OCSP CA response for any reason,
367
+ the connection fails.
368
+ FAIL_OPEN: A response indicating a revoked certificate results in a failed connection. A response with any
369
+ other certificate errors or statuses allows the connection to occur, but denotes the message in the logs
370
+ at the WARNING level with the relevant details in JSON format.
371
+ INSECURE (deprecated): The connection will occur anyway.
372
+ DISABLE_OCSP_CHECKS: The OCSP check will not happen. If the certificate is valid then connection will occur.
373
+ """
374
+
375
+ FAIL_CLOSED = "FAIL_CLOSED"
376
+ FAIL_OPEN = "FAIL_OPEN"
377
+ INSECURE = "INSECURE"
378
+ DISABLE_OCSP_CHECKS = "DISABLE_OCSP_CHECKS"
379
+
380
+
381
+ @unique
382
+ class FileTransferType(Enum):
383
+ """This enum keeps track of the possible file transfer types."""
384
+
385
+ PUT = auto()
386
+ GET = auto()
387
+
388
+
389
+ @unique
390
+ class QueryStatus(Enum):
391
+ RUNNING = 0
392
+ ABORTING = 1
393
+ SUCCESS = 2
394
+ FAILED_WITH_ERROR = 3
395
+ ABORTED = 4
396
+ QUEUED = 5
397
+ FAILED_WITH_INCIDENT = 6
398
+ DISCONNECTED = 7
399
+ RESUMING_WAREHOUSE = 8
400
+ # purposeful typo. Is present in QueryDTO.java
401
+ QUEUED_REPARING_WAREHOUSE = 9
402
+ RESTARTED = 10
403
+ BLOCKED = 11
404
+ NO_DATA = 12
405
+
406
+
407
+ # Size constants
408
+ kilobyte = 1024
409
+ megabyte = kilobyte * 1024
410
+ gigabyte = megabyte * 1024
411
+
412
+
413
+ # ArrowResultChunk constants the unit in this iterator
414
+ # EMPTY_UNIT: default
415
+ # ROW_UNIT: fetch row by row if the user call `fetchone()`
416
+ # TABLE_UNIT: fetch one arrow table if the user call `fetch_pandas()`
417
+ @unique
418
+ class IterUnit(Enum):
419
+ ROW_UNIT = "row"
420
+ TABLE_UNIT = "table"
421
+
422
+
423
+ # File Transfer
424
+ # Amazon S3 multipart upload limits
425
+ # https://docs.aws.amazon.com/AmazonS3/latest/userguide/qfacts.html
426
+ S3_DEFAULT_CHUNK_SIZE = 8 * 1024**2
427
+ S3_MAX_OBJECT_SIZE = 5 * 1024**4
428
+ S3_MAX_PART_SIZE = 5 * 1024**3
429
+ S3_MIN_PART_SIZE = 5 * 1024**2
430
+ S3_MAX_PARTS = 10000
431
+
432
+ S3_CHUNK_SIZE = 8388608 # boto3 default
433
+ AZURE_CHUNK_SIZE = 4 * megabyte
434
+
435
+ # https://requests.readthedocs.io/en/latest/user/advanced/#timeouts
436
+ REQUEST_CONNECTION_TIMEOUT = 10
437
+ REQUEST_READ_TIMEOUT = 600
438
+
439
+ DAY_IN_SECONDS = 60 * 60 * 24
440
+
441
+ # TODO: all env variables definitions should be here
442
+ ENV_VAR_PARTNER = "SF_PARTNER"
443
+ ENV_VAR_TEST_MODE = "SNOWFLAKE_TEST_MODE"
444
+ ENV_VAR_DISABLE_PLATFORM_DETECTION = "SNOWFLAKE_DISABLE_PLATFORM_DETECTION"
445
+ ENV_VAR_ENABLE_CUSTOM_REVOCATION_ERRORS = "SNOWFLAKE_ENABLE_CUSTOM_REVOCATION_ERRORS"
446
+
447
+ # Boolean positive values (lowercased) for environment variable checks
448
+ ENV_VAR_BOOL_POSITIVE_VALUES_LOWERCASED = ["true"]
449
+
450
+ _DOMAIN_NAME_MAP = {_DEFAULT_HOSTNAME_TLD: "GLOBAL", _CHINA_HOSTNAME_TLD: "CHINA"}
451
+
452
+ _CONNECTIVITY_ERR_MSG = (
453
+ "Verify that the hostnames and port numbers in SYSTEM$ALLOWLIST are added to your firewall's allowed list."
454
+ "\nTo further troubleshoot your connection you may reference the following article: "
455
+ "https://docs.snowflake.com/en/user-guide/client-connectivity-troubleshooting/overview."
456
+ )
457
+
458
+ _OAUTH_DEFAULT_SCOPE = "session:role:{role}"
459
+ OAUTH_TYPE_AUTHORIZATION_CODE = "oauth_authorization_code"
460
+ OAUTH_TYPE_CLIENT_CREDENTIALS = "oauth_client_credentials"