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,118 @@
1
+ #!/usr/bin/env python
2
+ # Python Db API v2
3
+ #
4
+ from __future__ import annotations
5
+
6
+
7
+ # start delvewheel patch
8
+ def _delvewheel_patch_1_12_0():
9
+ import os
10
+ if os.path.isdir(libs_dir := os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, 'snowflake_connector_python.libs'))):
11
+ os.add_dll_directory(libs_dir)
12
+
13
+
14
+ _delvewheel_patch_1_12_0()
15
+ del _delvewheel_patch_1_12_0
16
+ # end delvewheel patch
17
+
18
+ from functools import wraps
19
+
20
+ from ._utils import _core_loader
21
+
22
+ apilevel = "2.0"
23
+ threadsafety = 2
24
+ paramstyle = "pyformat"
25
+
26
+ import logging
27
+ from logging import NullHandler
28
+
29
+ from snowflake.connector.externals_utils.externals_setup import setup_external_libraries
30
+
31
+ from .connection import SnowflakeConnection
32
+ from .cursor import DictCursor
33
+ from .dbapi import (
34
+ BINARY,
35
+ DATETIME,
36
+ NUMBER,
37
+ ROWID,
38
+ STRING,
39
+ Binary,
40
+ Date,
41
+ DateFromTicks,
42
+ Time,
43
+ TimeFromTicks,
44
+ Timestamp,
45
+ TimestampFromTicks,
46
+ )
47
+ from .errors import (
48
+ DatabaseError,
49
+ DataError,
50
+ Error,
51
+ IntegrityError,
52
+ InterfaceError,
53
+ InternalError,
54
+ NotSupportedError,
55
+ OperationalError,
56
+ ProgrammingError,
57
+ _Warning,
58
+ )
59
+ from .log_configuration import EasyLoggingConfigPython
60
+ from .version import VERSION
61
+
62
+ # Load the core library - failures are captured in core_loader and don't prevent module loading
63
+ try:
64
+ _core_loader.load()
65
+ except Exception:
66
+ # Silently continue if core loading fails - the error is already captured in core_loader
67
+ # This ensures the connector module loads even if the minicore library is unavailable
68
+ pass
69
+
70
+ logging.getLogger(__name__).addHandler(NullHandler())
71
+ setup_external_libraries()
72
+
73
+
74
+ @wraps(SnowflakeConnection.__init__)
75
+ def Connect(**kwargs) -> SnowflakeConnection:
76
+ return SnowflakeConnection(**kwargs)
77
+
78
+
79
+ connect = Connect
80
+
81
+ SNOWFLAKE_CONNECTOR_VERSION = ".".join(str(v) for v in VERSION[0:3])
82
+ __version__ = SNOWFLAKE_CONNECTOR_VERSION
83
+
84
+ __all__ = [
85
+ "SnowflakeConnection",
86
+ # Error handling
87
+ "Error",
88
+ "_Warning",
89
+ "InterfaceError",
90
+ "DatabaseError",
91
+ "NotSupportedError",
92
+ "DataError",
93
+ "IntegrityError",
94
+ "ProgrammingError",
95
+ "OperationalError",
96
+ "InternalError",
97
+ # Extended cursor
98
+ "DictCursor",
99
+ # DBAPI PEP 249 required exports
100
+ "connect",
101
+ "apilevel",
102
+ "threadsafety",
103
+ "paramstyle",
104
+ "Date",
105
+ "Time",
106
+ "Timestamp",
107
+ "Binary",
108
+ "DateFromTicks",
109
+ "TimeFromTicks",
110
+ "TimestampFromTicks",
111
+ "STRING",
112
+ "BINARY",
113
+ "NUMBER",
114
+ "DATETIME",
115
+ "ROWID",
116
+ # Extended data type (experimental)
117
+ "EasyLoggingConfigPython",
118
+ ]
@@ -0,0 +1,276 @@
1
+ from __future__ import annotations
2
+
3
+ from functools import total_ordering
4
+ from hashlib import md5
5
+ from logging import getLogger
6
+ from threading import Lock
7
+ from typing import Any, Iterable
8
+
9
+ from sortedcontainers import SortedSet
10
+
11
+ logger = getLogger(__name__)
12
+
13
+
14
+ @total_ordering
15
+ class QueryContextElement:
16
+ def __init__(
17
+ self, id: int, read_timestamp: int, priority: int, context: str
18
+ ) -> None:
19
+ # entry with id = 0 is the main entry
20
+ self.id = id
21
+ self.read_timestamp = read_timestamp
22
+ # priority values are 0..N with 0 being the highest priority
23
+ self.priority = priority
24
+ # OpaqueContext field will be base64 encoded in GS, but it is opaque to client side. Client side should not do decoding/encoding and just store the raw data.
25
+ self.context = context
26
+
27
+ def __eq__(self, other: object) -> bool:
28
+ if not isinstance(other, QueryContextElement):
29
+ return False
30
+ return (
31
+ self.id == other.id
32
+ and self.read_timestamp == other.read_timestamp
33
+ and self.priority == other.priority
34
+ and self.context == other.context
35
+ )
36
+
37
+ def __lt__(self, other: Any) -> bool:
38
+ if not isinstance(other, QueryContextElement):
39
+ raise TypeError(
40
+ f"cannot compare QueryContextElement with object of type {type(other)}"
41
+ )
42
+ return self.priority < other.priority
43
+
44
+ def __hash__(self) -> int:
45
+ _hash = 31
46
+
47
+ _hash = _hash * 31 + self.id
48
+ _hash += (_hash * 31) + self.read_timestamp
49
+ _hash += (_hash * 31) + self.priority
50
+ if self.context:
51
+ _hash += (_hash * 31) + int.from_bytes(
52
+ md5(self.context.encode("utf-8")).digest(), "big"
53
+ )
54
+ return _hash
55
+
56
+ def __str__(self) -> str:
57
+ return f"({self.id}, {self.read_timestamp}, {self.priority})"
58
+
59
+
60
+ class QueryContextCache:
61
+ def __init__(self, capacity: int) -> None:
62
+ self.capacity = capacity
63
+ self._id_map: dict[int, QueryContextElement] = {}
64
+ self._priority_map: dict[int, QueryContextElement] = {}
65
+ self._intermediate_priority_map: dict[int, QueryContextElement] = {}
66
+
67
+ # stores elements sorted by priority. Element with
68
+ # least priority value has the highest priority
69
+ self._tree_set: set[QueryContextElement] = SortedSet()
70
+ self._lock = Lock()
71
+ self._data: str = None
72
+
73
+ def _add_qce(self, qce: QueryContextElement) -> None:
74
+ """Adds qce element in tree_set, id_map and intermediate_priority_map.
75
+ We still need to add _sync_priority_map after all the new qce have been merged
76
+ into the cache.
77
+ """
78
+ self._tree_set.add(qce)
79
+ self._id_map[qce.id] = qce
80
+ self._intermediate_priority_map[qce.priority] = qce
81
+
82
+ def _remove_qce(self, qce: QueryContextElement) -> None:
83
+ self._id_map.pop(qce.id)
84
+ self._priority_map.pop(qce.priority)
85
+ self._tree_set.remove(qce)
86
+
87
+ def _replace_qce(
88
+ self, old_qce: QueryContextElement, new_qce: QueryContextElement
89
+ ) -> None:
90
+ """This is just a convenience function to call a remove and add operation back-to-back"""
91
+ self._remove_qce(old_qce)
92
+ self._add_qce(new_qce)
93
+
94
+ def _sync_priority_map(self):
95
+ """
96
+ Sync the _intermediate_priority_map with the _priority_map at the end of the current round of inserts.
97
+ """
98
+ logger.debug(
99
+ f"sync_priority_map called priority_map size = {len(self._priority_map)}, new_priority_map size = {len(self._intermediate_priority_map)}"
100
+ )
101
+
102
+ self._priority_map.update(self._intermediate_priority_map)
103
+ # Clear the _intermediate_priority_map for the next round of QCC insert (a round consists of multiple entries)
104
+ self._intermediate_priority_map.clear()
105
+
106
+ def insert(self, id: int, read_timestamp: int, priority: int, context: str) -> None:
107
+ if id in self._id_map:
108
+ qce = self._id_map[id]
109
+ if (read_timestamp > qce.read_timestamp) or (
110
+ read_timestamp == qce.read_timestamp and priority != qce.priority
111
+ ):
112
+ # when id if found in cache and we are operating on a more recent timestamp. We do not update in-place here.
113
+ new_qce = QueryContextElement(id, read_timestamp, priority, context)
114
+ self._replace_qce(qce, new_qce)
115
+ else:
116
+ new_qce = QueryContextElement(id, read_timestamp, priority, context)
117
+ if priority in self._priority_map:
118
+ old_qce = self._priority_map[priority]
119
+ self._replace_qce(old_qce, new_qce)
120
+ else:
121
+ self._add_qce(new_qce)
122
+
123
+ def trim_cache(self) -> None:
124
+ logger.debug(
125
+ f"trim_cache() called. treeSet size is {len(self._tree_set)} and cache capacity is {self.capacity}"
126
+ )
127
+
128
+ while len(self) > self.capacity:
129
+ # remove the qce with highest priority value => element with least priority
130
+ qce = self._last()
131
+ self._remove_qce(qce)
132
+
133
+ logger.debug(
134
+ f"trim_cache() returns. treeSet size is {len(self._tree_set)} and cache capacity is {self.capacity}"
135
+ )
136
+
137
+ def clear_cache(self) -> None:
138
+ logger.debug("clear_cache() called")
139
+ self._id_map.clear()
140
+ self._priority_map.clear()
141
+ self._tree_set.clear()
142
+ self._intermediate_priority_map.clear()
143
+
144
+ def _get_elements(self) -> Iterable[QueryContextElement]:
145
+ return self._tree_set
146
+
147
+ def _last(self) -> QueryContextElement:
148
+ return self._tree_set[-1]
149
+
150
+ def serialize_to_dict(self) -> dict:
151
+ with self._lock:
152
+ logger.debug("serialize_to_dict() called")
153
+ self.log_cache_entries()
154
+
155
+ if len(self._tree_set) == 0:
156
+ return {} # we should return an empty dict
157
+
158
+ try:
159
+ data = {
160
+ "entries": [
161
+ {
162
+ "id": qce.id,
163
+ "timestamp": qce.read_timestamp,
164
+ "priority": qce.priority,
165
+ "context": (
166
+ {"base64Data": qce.context}
167
+ if qce.context is not None
168
+ else {}
169
+ ),
170
+ }
171
+ for qce in self._tree_set
172
+ ]
173
+ }
174
+ # Because on GS side, `context` field is an object with `base64Data` string member variable,
175
+ # we should serialize `context` field to an object instead of string directly to stay consistent with GS side.
176
+
177
+ logger.debug(f"serialize_to_dict(): data to send to server {data}")
178
+
179
+ # query context shoule be an object field of the HTTP request body JSON and on GS side. here we should only return a dict
180
+ # and let the outer HTTP request body to convert the entire big dict to a single JSON.
181
+ return data
182
+ except Exception as e:
183
+ logger.debug(f"serialize_to_dict(): Exception {e}")
184
+ return {}
185
+
186
+ def deserialize_json_dict(self, data: dict) -> None:
187
+ with self._lock:
188
+ logger.debug(f"deserialize_json_dict() called: data from server: {data}")
189
+ self.log_cache_entries()
190
+
191
+ if data is None or len(data) == 0:
192
+ self.clear_cache()
193
+ logger.debug("deserialize_json_dict() returns")
194
+ self.log_cache_entries()
195
+ return
196
+
197
+ try:
198
+ # Deserialize the entries. The first entry with priority 0 is the main entry. On python
199
+ # connector side, we save all entries into one list to simplify the logic. When python
200
+ # connector receives HTTP response, the data["queryContext"] field has been converted
201
+ # from JSON to dict type automatically, so for this function we deserialize from python
202
+ # dict directly. Below is an example QueryContext dict.
203
+ # {
204
+ # "entries": [
205
+ # {
206
+ # "id": 0,
207
+ # "read_timestamp": 123456789,
208
+ # "priority": 0,
209
+ # "context": "base64 encoded context"
210
+ # },
211
+ # {
212
+ # "id": 1,
213
+ # "read_timestamp": 123456789,
214
+ # "priority": 1,
215
+ # "context": "base64 encoded context"
216
+ # },
217
+ # {
218
+ # "id": 2,
219
+ # "read_timestamp": 123456789,
220
+ # "priority": 2,
221
+ # "context": "base64 encoded context"
222
+ # }
223
+ # ]
224
+ # }
225
+
226
+ # Deserialize entries
227
+ entries = data.get("entries", list())
228
+ for entry in entries:
229
+ logger.debug(f"deserialize {entry}")
230
+ if not isinstance(entry.get("id"), int):
231
+ logger.debug("id type error")
232
+ raise TypeError(
233
+ f"Invalid type for 'id' field: Expected int, got {type(entry['id'])}"
234
+ )
235
+ if not isinstance(entry.get("timestamp"), int):
236
+ logger.debug("timestamp type error")
237
+ raise TypeError(
238
+ f"Invalid type for 'timestamp' field: Expected int, got {type(entry['timestamp'])}"
239
+ )
240
+ if not isinstance(entry.get("priority"), int):
241
+ logger.debug("priority type error")
242
+ raise TypeError(
243
+ f"Invalid type for 'priority' field: Expected int, got {type(entry['priority'])}"
244
+ )
245
+
246
+ # OpaqueContext field currently is empty from GS side.
247
+ context = entry.get("context", None)
248
+ if context and not isinstance(entry.get("context"), str):
249
+ logger.debug("context type error")
250
+ raise TypeError(
251
+ f"Invalid type for 'context' field: Expected str, got {type(entry['context'])}"
252
+ )
253
+ self.insert(
254
+ entry.get("id"),
255
+ entry.get("timestamp"),
256
+ entry.get("priority"),
257
+ context,
258
+ )
259
+
260
+ # Sync the priority map at the end of for loop insert.
261
+ self._sync_priority_map()
262
+ except Exception as e:
263
+ logger.debug(f"deserialize_json_dict: Exception = {e}")
264
+ # clear cache due to incomplete insert
265
+ self.clear_cache()
266
+
267
+ self.trim_cache()
268
+ logger.debug("deserialize_json_dict() returns")
269
+ self.log_cache_entries()
270
+
271
+ def log_cache_entries(self) -> None:
272
+ for qce in self._tree_set:
273
+ logger.debug(f"Cache Entry: {str(qce)}")
274
+
275
+ def __len__(self) -> int:
276
+ return len(self._tree_set)
@@ -0,0 +1,48 @@
1
+ from __future__ import annotations
2
+
3
+ import re
4
+
5
+ from .constants import FileTransferType
6
+
7
+ COMMENT_START_SQL_RE = re.compile(
8
+ r"""
9
+ ^\s*(?:
10
+ /\*[\w\W]*?\*/
11
+ )""",
12
+ re.VERBOSE,
13
+ )
14
+
15
+ PUT_SQL_RE = re.compile(r"^\s*put", flags=re.IGNORECASE)
16
+ GET_SQL_RE = re.compile(r"^\s*get", flags=re.IGNORECASE)
17
+
18
+
19
+ def remove_starting_comments(sql: str) -> str:
20
+ """Remove all comments from the start of a SQL statement."""
21
+ commentless_sql = sql
22
+ while True:
23
+ start_comment = COMMENT_START_SQL_RE.match(commentless_sql)
24
+ if start_comment is None:
25
+ break
26
+ commentless_sql = commentless_sql[start_comment.end() :]
27
+ return commentless_sql
28
+
29
+
30
+ def get_file_transfer_type(sql: str) -> FileTransferType | None:
31
+ """Decide whether a SQL is a file transfer and return its type.
32
+
33
+ None is returned if the SQL isn't a file transfer so that this function can be
34
+ used in an if-statement.
35
+ """
36
+ commentless_sql = remove_starting_comments(sql)
37
+ if PUT_SQL_RE.match(commentless_sql):
38
+ return FileTransferType.PUT
39
+ elif GET_SQL_RE.match(commentless_sql):
40
+ return FileTransferType.GET
41
+
42
+
43
+ def is_put_statement(sql: str) -> bool:
44
+ return get_file_transfer_type(sql) == FileTransferType.PUT
45
+
46
+
47
+ def is_get_statement(sql: str) -> bool:
48
+ return get_file_transfer_type(sql) == FileTransferType.GET