无法使用雪花连接器 python v1.9 建立连接



(代表客户提出以下问题(

............

由于所有依赖项的大小 snowflake-connector-python 我不得不切换到 v1.9(总大小为 106Mb(,现在我无法建立连接,v2.0 也无法正常工作。唯一有效的版本是 v2.0.1,但与 v320 相比,它很大(总大小为 320Mb(。

Traceback (most recent call last):
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ocsp_snowflake.py", line 1131, in validate_by_direct_connection
self.process_ocsp_response(issuer, cert_id, ocsp_response)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ocsp_asn1crypto.py", line 280, in process_ocsp_response
tbs_response_data)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ocsp_asn1crypto.py", line 316, in verify_signature
pubkey = cert.public_key.unwrap().dump()
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/asn1crypto/keys.py", line 1065, in unwrap
'asn1crypto.keys.PublicKeyInfo().unwrap() has been removed, '
asn1crypto._errors.APIException: asn1crypto.keys.PublicKeyInfo().unwrap() has been removed, please use oscrypto.asymmetric.PublicKey().unwrap() instead

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/network.py", line 790, in _request_exec
auth=SnowflakeAuth(token),
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/botocore/vendored/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/botocore/vendored/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/botocore/vendored/requests/adapters.py", line 370, in send
timeout=timeout
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 544, in urlopen
body=body, headers=headers)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 341, in _make_request
self._validate_conn(conn)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 761, in _validate_conn
conn.connect()
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/botocore/vendored/requests/packages/urllib3/connection.py", line 238, in connect
ssl_version=resolved_ssl_version)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ssl_wrap_socket.py", line 395, in ssl_wrap_socket_with_ocsp
).validate(server_hostname, ret.connection)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ocsp_snowflake.py", line 996, in validate
return self._validate(hostname, cert_data, telemetry_data, do_retry, no_exception)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ocsp_snowflake.py", line 1002, in _validate
cert_data, telemetry_data, hostname, do_retry=do_retry)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ocsp_snowflake.py", line 1184, in _validate_certificates_sequential
issuer, subject, telemetry_data, hostname, do_retry=do_retry)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ocsp_snowflake.py", line 1153, in validate_by_direct_connection
err = self.verify_fail_open(ex, telemetry_data)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ocsp_snowflake.py", line 1166, in verify_fail_open
if ex_obj.errno is ER_SERVER_CERTIFICATE_REVOKED:
AttributeError: 'APIException' object has no attribute 'errno'
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/network.py", line 640, in _request_exec_wrapper
**kwargs)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/network.py", line 883, in _request_exec
raise RetryRequest(err)
snowflake.connector.network.RetryRequest: 'APIException' object has no attribute 'errno'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/avinogradov/git/crux/step_function/snowflake_update/test.py", line 25, in <module>
schema=SCHEMA
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/__init__.py", line 33, in Connect
return SnowflakeConnection(**kwargs)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/connection.py", line 187, in __init__
self.connect(**kwargs)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/connection.py", line 484, in connect
self.__open_connection()
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/connection.py", line 700, in __open_connection
self.__authenticate(auth_instance)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/connection.py", line 931, in __authenticate
session_parameters=self._session_parameters,
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/auth.py", line 197, in authenticate
socket_timeout=self._rest._connection.login_timeout)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/network.py", line 521, in _post_request
_include_retry_params=_include_retry_params)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/network.py", line 600, in fetch
**kwargs)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/network.py", line 683, in _request_exec_wrapper
conn, full_url, cause)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/network.py", line 713, in handle_invalid_certificate_error
u'errno': ER_FAILED_TO_REQUEST,
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/errors.py", line 100, in errorhandler_wrapper
connection.errorhandler(connection, cursor, errorclass, errorvalue)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/errors.py", line 73, in default_errorhandler
done_format_msg=errorvalue.get(u'done_format_msg'))
snowflake.connector.errors.OperationalError: 250003: Failed to execute request: 'APIException' object has no attribute 'errno'

............

客户端目前可以使用最新版本 (2.0.1( 解决此问题,但稍后删除 pyarrow 和 numpy (pip uninstall pyarrow numpy( 以减少依赖项大小(这些依赖项仅供个人预览版的客户使用(。

有没有更好的建议?

您是正确的,这是在 v2.0.1 中修复的问题。使用最近升级的 asn1crypto 1.0.0 包验证证书时,旧版本的 Python 连接器失败。解决方法是使用 asn1crypt 0.24.0。

pip install snowflake-connector-python asn1crypto==0.24.0 

相关内容

  • 没有找到相关文章

最新更新