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,64 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import pathlib
5
+ from functools import cached_property
6
+ from typing import Protocol
7
+
8
+ from platformdirs import PlatformDirs
9
+
10
+
11
+ class PlatformDirsProto(Protocol):
12
+ @property
13
+ def user_config_path(self) -> pathlib.Path: ...
14
+
15
+
16
+ def _resolve_platform_dirs() -> PlatformDirsProto:
17
+ """Decide on what PlatformDirs class to use.
18
+
19
+ In case a folder exists (which can be customized with the environmental
20
+ variable `SNOWFLAKE_HOME`) we use that directory as all platform
21
+ directories. If this folder does not exist we'll fall back to platformdirs
22
+ defaults.
23
+
24
+ This helper function was introduced to make this code testable.
25
+ """
26
+ platformdir_kwargs = {
27
+ "appname": "snowflake",
28
+ "appauthor": False,
29
+ }
30
+ snowflake_home = pathlib.Path(
31
+ os.environ.get("SNOWFLAKE_HOME", "~/.snowflake/"),
32
+ ).expanduser()
33
+ if snowflake_home.exists():
34
+ return SFPlatformDirs(
35
+ str(snowflake_home),
36
+ **platformdir_kwargs,
37
+ )
38
+ else:
39
+ # In case SNOWFLAKE_HOME does not exist we fall back to using
40
+ # platformdirs to determine where system files should be placed. Please
41
+ # see docs for all the directories defined in the module at
42
+ # https://platformdirs.readthedocs.io/
43
+ return PlatformDirs(**platformdir_kwargs)
44
+
45
+
46
+ class SFPlatformDirs:
47
+ """Single folder platformdirs.
48
+
49
+ This class introduces a PlatformDir class where everything is placed into a
50
+ single folder. This is intended for users who prefer portability over all
51
+ else.
52
+ """
53
+
54
+ def __init__(
55
+ self,
56
+ single_dir: str,
57
+ **kwargs,
58
+ ) -> None:
59
+ self.single_dir = pathlib.Path(single_dir)
60
+
61
+ @cached_property
62
+ def user_config_path(self) -> str:
63
+ """data directory tied to to the user"""
64
+ return self.single_dir
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env python
2
+ from __future__ import annotations
3
+
4
+ from base64 import b16decode, b16encode, standard_b64encode
5
+
6
+ from .errors import InternalError
7
+
8
+ # Converts a Snowflake binary value into a "bytes" object.
9
+ binary_to_python = b16decode
10
+
11
+
12
+ def binary_to_snowflake(binary_value) -> bytes | bytearray:
13
+ """Encodes a "bytes" object for passing to Snowflake."""
14
+ result = b16encode(binary_value)
15
+
16
+ if isinstance(binary_value, bytearray):
17
+ return bytearray(result)
18
+ return result
19
+
20
+
21
+ class SnowflakeBinaryFormat:
22
+ """Formats binary values ("bytes" objects) in hex or base64."""
23
+
24
+ def __init__(self, name) -> None:
25
+ name = name.upper()
26
+ if name == "HEX":
27
+ self._encode = b16encode
28
+ elif name == "BASE64":
29
+ self._encode = standard_b64encode
30
+ else:
31
+ raise InternalError(f"Unrecognized binary format {name}")
32
+
33
+ def format(self, binary_value):
34
+ """Formats a "bytes" object, returning a string."""
35
+ return self._encode(binary_value).decode("ascii")
@@ -0,0 +1,345 @@
1
+ #!/usr/bin/env python
2
+ from __future__ import annotations
3
+
4
+ import time
5
+ from collections import namedtuple
6
+ from datetime import date, datetime, timedelta
7
+ from time import struct_time
8
+
9
+ ZERO_TIMEDELTA = timedelta(0)
10
+
11
+ ElementType = {
12
+ "Year2digit_ElementType": ["YY", "%y"],
13
+ "Year_ElementType": ["YYYY", "%Y"],
14
+ "Month_ElementType": ["MM", "%m"],
15
+ "MonthAbbrev_ElementType": ["MON", "%b"],
16
+ "DayOfMonth_ElementType": ["DD", "%d"],
17
+ "DayOfWeekAbbrev_ElementType": ["DY", "%a"],
18
+ "Hour24_ElementType": ["HH24", "%H"],
19
+ "Hour12_ElementType": ["HH12", "%I"],
20
+ "Hour_ElementType": ["HH", "%H"],
21
+ "Ante_Meridiem_ElementType": ["AM", "%p"],
22
+ "Post_Meridiem_ElementType": ["PM", "%p"],
23
+ "Minute_ElementType": ["MI", "%M"],
24
+ "Second_ElementType": ["SS", "%S"],
25
+ "MilliSecond_ElementType": ["FF", ""],
26
+ # special code for parsing fractions
27
+ "TZOffsetHourColonMin_ElementType": ["TZH:TZM", "%z"],
28
+ "TZOffsetHourMin_ElementType": ["TZHTZM", "%z"],
29
+ "TZOffsetHourOnly_ElementType": ["TZH", "%z"],
30
+ "TZAbbr_ElementType": ["TZD", "%Z"],
31
+ }
32
+
33
+
34
+ def sfdatetime_total_seconds_from_timedelta(td: timedelta) -> int:
35
+ return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) // 10**6
36
+
37
+
38
+ SnowflakeDateTime = namedtuple("SnowflakeDateTime", "datetime nanosecond scale")
39
+
40
+
41
+ def _support_negative_year(value: SnowflakeDateTime, year_len: int) -> str:
42
+ # if YYYY/YY is included
43
+ return _build_year_format(value.datetime, year_len)
44
+
45
+
46
+ def _support_negative_year_datetime(value, year_len):
47
+ # if YYYY/YY is included
48
+ return _build_year_format(value, year_len)
49
+
50
+
51
+ def _build_year_format(dt: datetime | struct_time, year_len: int) -> str:
52
+ if hasattr(dt, "year"):
53
+ # datetime
54
+ year_raw_value = dt.year
55
+ else:
56
+ # struct_time
57
+ year_raw_value = dt.tm_year
58
+ return _build_raw_year_format(year_raw_value, year_len)
59
+
60
+
61
+ def _support_negative_year_struct_time(dt: struct_time, year_len: int) -> str:
62
+ # struct_time
63
+ return _build_raw_year_format(dt.tm_year, year_len)
64
+
65
+
66
+ def _build_raw_year_format(year_raw_value: int, year_len: int) -> str:
67
+ sign_char = ""
68
+ if year_raw_value < 0:
69
+ sign_char = "-"
70
+ year_raw_value *= -1
71
+ if year_len == 2:
72
+ year_raw_value %= 100
73
+ fmt = sign_char + "{:0" + str(year_len) + "d}"
74
+ return fmt.format(year_raw_value)
75
+
76
+
77
+ def _support_negative_year_date(value, year_len):
78
+ # if YYYY/YY is included
79
+ return _build_year_format(value, year_len)
80
+
81
+
82
+ def _inject_fraction(value: SnowflakeDateTime | datetime, fraction_len: int) -> str:
83
+ # if FF is included
84
+ nano_str = "{:09d}"
85
+
86
+ if hasattr(value, "microsecond"):
87
+ nano_str = "{:06d}"
88
+ fraction = value.microsecond
89
+ elif hasattr(value, "nanosecond"):
90
+ fraction = value.nanosecond
91
+ else:
92
+ nano_str = "{:01d}"
93
+ fraction = 0 # struct_time. no fraction of second
94
+
95
+ if fraction_len > 0:
96
+ # truncate up to the specified length of FF
97
+ nano_value = nano_str.format(fraction)[:fraction_len]
98
+ else:
99
+ # no length of FF is specified
100
+ nano_value = nano_str.format(fraction)
101
+ if hasattr(value, "scale"):
102
+ # but scale is specified
103
+ nano_value = nano_value[: value.scale]
104
+ return nano_value
105
+
106
+
107
+ def _inject_others(_: SnowflakeDateTime | struct_time, value0: str) -> str:
108
+ return value0
109
+
110
+
111
+ NOT_OTHER_FORMAT = {
112
+ _support_negative_year,
113
+ _support_negative_year_datetime,
114
+ _support_negative_year_struct_time,
115
+ _support_negative_year_date,
116
+ _inject_fraction,
117
+ }
118
+
119
+
120
+ class SnowflakeDateTimeFormat:
121
+ """Snowflake DateTime Formatter."""
122
+
123
+ def __init__(
124
+ self,
125
+ sql_format,
126
+ data_type: str = "TIMESTAMP_NTZ",
127
+ datetime_class=datetime,
128
+ support_negative_year: bool = True,
129
+ inject_fraction: bool = True,
130
+ ) -> None:
131
+ self._sql_format = sql_format
132
+ self._ignore_tz = data_type in ("TIMESTAMP_NTZ", "DATE")
133
+ if datetime_class == datetime:
134
+ self._support_negative_year_method = _support_negative_year_datetime
135
+ elif datetime_class == time.struct_time:
136
+ self._support_negative_year_method = _support_negative_year_struct_time
137
+ elif datetime_class == date:
138
+ self._support_negative_year_method = _support_negative_year_date
139
+ else:
140
+ self._support_negative_year_method = _support_negative_year
141
+
142
+ # format method
143
+ self.format = getattr(self, f"_format_{datetime_class.__name__}")
144
+ self._compile(
145
+ support_negative_year=support_negative_year, inject_fraction=inject_fraction
146
+ )
147
+
148
+ def _pre_format(self, value: SnowflakeDateTime | struct_time) -> str:
149
+ fmt = []
150
+ for e in self._elements:
151
+ f = e[0]
152
+ fmt.append(f(value, e[1]))
153
+ return "".join(fmt)
154
+
155
+ def _format_SnowflakeDateTime(self, value: SnowflakeDateTime) -> str:
156
+ """Formats SnowflakeDateTime object."""
157
+ fmt = self._pre_format(value)
158
+ dt = value.datetime
159
+ if isinstance(dt, time.struct_time):
160
+ return str(time.strftime(fmt, dt))
161
+ if dt.year < 1000:
162
+ # NOTE: still not supported
163
+ return dt.isoformat()
164
+ return dt.strftime(fmt)
165
+
166
+ def _format_datetime(self, value):
167
+ """Formats datetime object."""
168
+ fmt = self._pre_format(value)
169
+ if isinstance(value, time.struct_time):
170
+ return str(time.strftime(fmt, value))
171
+ if value.year < 1000:
172
+ # NOTE: still not supported.
173
+ return value.isoformat()
174
+ return value.strftime(fmt)
175
+
176
+ def _match_token(self, sql_fmt, candidates, ignore: bool = False):
177
+ for c in candidates:
178
+ if sql_fmt.startswith(c[0]):
179
+ if not ignore:
180
+ self._elements.append((_inject_others, c[1]))
181
+ return len(c[0])
182
+ self._add_raw_char(sql_fmt[0])
183
+ return 1
184
+
185
+ def _add_raw_char(self, ch) -> None:
186
+ self._elements.append((_inject_others, "%%" if ch == "%" else ch))
187
+
188
+ def _compile(
189
+ self, support_negative_year: bool = True, inject_fraction: bool = True
190
+ ) -> None:
191
+ self._elements = []
192
+ idx = 0
193
+ u_sql_format = self._sql_format.upper()
194
+
195
+ while idx < len(u_sql_format):
196
+ ch = u_sql_format[idx]
197
+ if ch == "A":
198
+ idx += self._match_token(
199
+ u_sql_format[idx:],
200
+ [
201
+ ElementType["Ante_Meridiem_ElementType"],
202
+ ],
203
+ )
204
+ elif ch == "D":
205
+ idx += self._match_token(
206
+ u_sql_format[idx:],
207
+ [
208
+ ElementType["DayOfMonth_ElementType"],
209
+ ElementType["DayOfWeekAbbrev_ElementType"],
210
+ ],
211
+ )
212
+ elif ch == "H":
213
+ idx += self._match_token(
214
+ u_sql_format[idx:],
215
+ [
216
+ ElementType["Hour24_ElementType"],
217
+ ElementType["Hour12_ElementType"],
218
+ ElementType["Hour_ElementType"],
219
+ ],
220
+ )
221
+ elif ch == "M":
222
+ idx += self._match_token(
223
+ u_sql_format[idx:],
224
+ [
225
+ ElementType["MonthAbbrev_ElementType"],
226
+ ElementType["Month_ElementType"],
227
+ ElementType["Minute_ElementType"],
228
+ ],
229
+ )
230
+ elif ch == "P":
231
+ idx += self._match_token(
232
+ u_sql_format[idx:],
233
+ [
234
+ ElementType["Post_Meridiem_ElementType"],
235
+ ],
236
+ )
237
+ elif ch == "S":
238
+ idx += self._match_token(
239
+ u_sql_format[idx:],
240
+ [
241
+ ElementType["Second_ElementType"],
242
+ ],
243
+ )
244
+ elif ch == "T":
245
+ # ignore TZ format if data type doesn't have TZ.
246
+ idx += self._match_token(
247
+ u_sql_format[idx:],
248
+ [
249
+ ElementType["TZOffsetHourColonMin_ElementType"],
250
+ ElementType["TZOffsetHourMin_ElementType"],
251
+ ElementType["TZOffsetHourOnly_ElementType"],
252
+ ElementType["TZAbbr_ElementType"],
253
+ ],
254
+ ignore=self._ignore_tz,
255
+ )
256
+ elif ch == "Y":
257
+ idx += self._match_token(
258
+ u_sql_format[idx:],
259
+ [
260
+ ElementType["Year_ElementType"],
261
+ ElementType["Year2digit_ElementType"],
262
+ ],
263
+ )
264
+ if support_negative_year:
265
+ # Add a special directive to handle YYYY/YY
266
+ last_element = self._elements[-1]
267
+ if last_element[1] == "%Y":
268
+ del self._elements[-1]
269
+ self._elements.append((self._support_negative_year_method, 4))
270
+ elif last_element[1] == "%y":
271
+ del self._elements[-1]
272
+ self._elements.append((self._support_negative_year_method, 2))
273
+
274
+ elif ch == ".":
275
+ if idx + 1 < len(u_sql_format) and u_sql_format[idx + 1 :].startswith(
276
+ ElementType["MilliSecond_ElementType"][0]
277
+ ):
278
+ # Will be FF, just mark that there's a dot before FF
279
+ self._elements.append((_inject_others, "."))
280
+ self._fractions_with_dot = True
281
+ else:
282
+ self._add_raw_char(ch)
283
+ idx += 1
284
+ elif ch == "F":
285
+ if u_sql_format[idx:].startswith(
286
+ ElementType["MilliSecond_ElementType"][0]
287
+ ):
288
+ idx += len(ElementType["MilliSecond_ElementType"][0])
289
+ if inject_fraction:
290
+ # Construct formatter to find fractions position.
291
+ fractions_len = -1
292
+ if idx < len(u_sql_format) and u_sql_format[idx].isdigit():
293
+ # followed by a single digit?
294
+ fractions_len = int(u_sql_format[idx])
295
+ idx += 1
296
+ self._elements.append((_inject_fraction, fractions_len))
297
+ else:
298
+ self._elements.append((_inject_others, "0"))
299
+ else:
300
+ self._add_raw_char(ch)
301
+ idx += 1
302
+ elif ch == '"':
303
+ # copy a double quoted string to the python format
304
+ idx += 1
305
+ start_idx = idx
306
+ while idx < len(self._sql_format) and self._sql_format[idx] != '"':
307
+ idx += 1
308
+
309
+ self._elements.append((_inject_others, self._sql_format[start_idx:idx]))
310
+ if idx < len(self._sql_format):
311
+ idx += 1
312
+ else:
313
+ self._add_raw_char(ch)
314
+ idx += 1
315
+ self._optimize_elements()
316
+
317
+ def _optimize_elements(self) -> None:
318
+ if len(self._elements) < 2:
319
+ return
320
+ last_element = self._elements[-1]
321
+ if last_element[0] in NOT_OTHER_FORMAT:
322
+ return
323
+ second_last_element = self._elements[-2]
324
+ if second_last_element[0] in NOT_OTHER_FORMAT:
325
+ return
326
+ del self._elements[-1]
327
+ del self._elements[-1]
328
+ self._elements.append(
329
+ (_inject_others, second_last_element[1] + last_element[1])
330
+ )
331
+
332
+
333
+ class SnowflakeDateFormat(SnowflakeDateTimeFormat):
334
+ def __init__(self, sql_format, **kwargs) -> None:
335
+ kwargs["inject_fraction"] = False # no fraction
336
+ super().__init__(sql_format, **kwargs)
337
+
338
+ def _format_struct_time(self, value: struct_time) -> str:
339
+ """Formats struct_time."""
340
+ fmt = self._pre_format(value)
341
+ return str(time.strftime(fmt, value))
342
+
343
+ def _format_date(self, value):
344
+ fmt = self._pre_format(value)
345
+ return value.strftime(fmt)
@@ -0,0 +1,144 @@
1
+ from __future__ import annotations
2
+
3
+ import logging
4
+ import warnings
5
+ from collections.abc import Mapping
6
+ from typing import Any
7
+
8
+
9
+ def getSnowLogger(
10
+ name: str,
11
+ extra: Mapping[str, object] | None = None,
12
+ ) -> SnowLogger:
13
+ logger = logging.getLogger(name)
14
+ return SnowLogger(logger, extra) # type:ignore[arg-type]
15
+
16
+
17
+ class SnowLogger(logging.LoggerAdapter):
18
+ """Snowflake Python logger wrapper of the built-in Python logger.
19
+
20
+ This logger wrapper supports user-provided logging info about
21
+ file name, function name and line number. This wrapper can be
22
+ used in Cython code (.pyx).
23
+ """
24
+
25
+ def debug( # type: ignore[override]
26
+ self,
27
+ msg: str,
28
+ path_name: str | None = None,
29
+ func_name: str | None = None,
30
+ *args: Any,
31
+ **kwargs: Any,
32
+ ) -> None:
33
+ self.log(logging.DEBUG, msg, path_name, func_name, *args, **kwargs)
34
+
35
+ def info( # type: ignore[override]
36
+ self,
37
+ msg: str,
38
+ path_name: str | None = None,
39
+ func_name: str | None = None,
40
+ *args: Any,
41
+ **kwargs: Any,
42
+ ) -> None:
43
+ self.log(logging.INFO, msg, path_name, func_name, *args, **kwargs)
44
+
45
+ def warning( # type: ignore[override]
46
+ self,
47
+ msg: str,
48
+ path_name: str | None = None,
49
+ func_name: str | None = None,
50
+ *args: Any,
51
+ **kwargs: Any,
52
+ ) -> None:
53
+ self.log(logging.WARNING, msg, path_name, func_name, *args, **kwargs)
54
+
55
+ def warn( # type: ignore[override]
56
+ self,
57
+ msg: str,
58
+ path_name: str | None = None,
59
+ func_name: str | None = None,
60
+ *args: Any,
61
+ **kwargs: Any,
62
+ ) -> None:
63
+ warnings.warn(
64
+ "The 'warn' method is deprecated, " "use 'warning' instead",
65
+ DeprecationWarning,
66
+ stacklevel=2,
67
+ )
68
+ self.warning(msg, path_name, func_name, *args, **kwargs)
69
+
70
+ def error( # type: ignore[override]
71
+ self,
72
+ msg: str,
73
+ path_name: str | None = None,
74
+ func_name: str | None = None,
75
+ *args: Any,
76
+ **kwargs: Any,
77
+ ) -> None:
78
+ self.log(logging.ERROR, msg, path_name, func_name, *args, **kwargs)
79
+
80
+ def exception( # type: ignore[override]
81
+ self,
82
+ msg: str,
83
+ path_name: str | None = None,
84
+ func_name: str | None = None,
85
+ *args: Any,
86
+ exc_info: bool = True,
87
+ **kwargs: Any,
88
+ ) -> None:
89
+ """Convenience method for logging an ERROR with exception information."""
90
+ self.error(msg, path_name, func_name, *args, exc_info=exc_info, **kwargs)
91
+
92
+ def critical( # type: ignore[override]
93
+ self,
94
+ msg: str,
95
+ path_name: str | None = None,
96
+ func_name: str | None = None,
97
+ *args: Any,
98
+ **kwargs: Any,
99
+ ) -> None:
100
+ self.log(logging.CRITICAL, msg, path_name, func_name, *args, **kwargs)
101
+
102
+ fatal = critical
103
+
104
+ def log( # type: ignore[override]
105
+ self,
106
+ level: int,
107
+ msg: str,
108
+ path_name: str | None = None,
109
+ func_name: str | None = None,
110
+ line_num: int = 0,
111
+ *args: Any,
112
+ **kwargs: Any,
113
+ ) -> None:
114
+ """Generalized log method of SnowLogger wrapper.
115
+
116
+ Args:
117
+ level: Logging level.
118
+ msg: Logging message.
119
+ path_name: Absolute or relative path of the file where the logger gets called.
120
+ func_name: Function inside which the logger gets called.
121
+ line_num: Line number at which the logger gets called.
122
+ """
123
+ if not path_name:
124
+ path_name = "path_name not provided"
125
+ if not func_name:
126
+ func_name = "func_name not provided"
127
+ if not isinstance(level, int):
128
+ if logging.raiseExceptions:
129
+ raise TypeError("level must be an integer")
130
+ else:
131
+ return
132
+ if self.logger.isEnabledFor(level):
133
+ record = self.logger.makeRecord(
134
+ self.logger.name,
135
+ level,
136
+ path_name,
137
+ line_num,
138
+ msg,
139
+ args,
140
+ None,
141
+ func_name,
142
+ **kwargs,
143
+ )
144
+ self.logger.handle(record)
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env python
2
+ SQLSTATE_CONNECTION_WAS_NOT_ESTABLISHED = "08001"
3
+ SQLSTATE_CONNECTION_ALREADY_EXISTS = "08002"
4
+ SQLSTATE_CONNECTION_NOT_EXISTS = "08003"
5
+ SQLSTATE_CONNECTION_REJECTED = "08004"
6
+ SQLSTATE_CONNECTION_FAILED_BUT_REESTABLISHED = "08506"
7
+ SQLSTATE_HOST_NOT_FOUND = "08508"
8
+ SQLSTATE_FEATURE_NOT_SUPPORTED = "0A000"
9
+ SQLSTATE_IO_ERROR = "58030"
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env python
2
+ from __future__ import annotations
3
+
4
+ from binascii import unhexlify
5
+
6
+ # key version
7
+ ocsp_internal_dep1_key_ver = 0.1
8
+ ocsp_internal_dep2_key_ver = 0.1
9
+
10
+ # OCSP Hard coded public keys
11
+ ocsp_internal_ssd_pub_dep1 = None
12
+ ocsp_internal_ssd_pub_dep2 = None
13
+
14
+ # Default cert if for key update directives
15
+ SF_KEY_UPDATE_SSD_DEFAULT_CERT_ID = 0
16
+
17
+
18
+ def ret_int_pub_key_ver(issuer):
19
+ if issuer == "dep1":
20
+ return ocsp_internal_dep1_key_ver
21
+ else:
22
+ return ocsp_internal_dep2_key_ver
23
+
24
+
25
+ def ret_wildcard_hkey():
26
+ issuer_name_hash = unhexlify("040130")
27
+ issuer_key_hash = unhexlify("040130")
28
+ serial_number = unhexlify("020100")
29
+ hkey = (issuer_name_hash, issuer_key_hash, serial_number)
30
+ return hkey