最新的雪花连接器似乎存在一些问题。我正在尝试在Ubuntu OS上安装它,并尝试连接到雪花,但是它给出了错误AttributeError:'SSLSocket'对象没有属性'connection'
以下是环境详细信息:-
我正在使用python3.5.2版本的ubuntu(Ubuntu 16.04.6 LTS),并且还安装了最新的雪花python连接器2.2.6。
这是pip3列表的输出
asn1crypto 1.3.0
awscli 1.11.13
天蓝色通用1.1.25
天蓝色存储blob 2.1.0
天蓝色存储通用2.1.0
信号灯1.3
boto3 1.13.7
Botocore 1.16.7
认证2020.4.5.1
cffi 1.13.2
chardet 2.3.0
cloud-init 19.4
科罗拉多州0.3.7
找不到命令0.3
configobj 5.0.6
密码学2.9.2
多卡地尔0.12
hibagent 1.0.1
idna 2.0
ijson 2.6.1
Jinja2 2.8
jmespath 0.9.0
jsonpatch 1.10
jsonpointer 1.9
语言选择器0.1
标记安全0.23
oauthlib 1.0.3
oscrypto 1.2.0
枕头3.1.2
点20.1
prettytable 0.7.2
pyasn1 0.1.9
pycparser 2.20
pycryptodomex 3.9.7
pycurl的7.43.0
Pygments 2.1
pygobject 3.20.0
PyJWT 1.3.0
pyOpenSSL 19.1.0
pyserial 3.0.1
python-apt 1.1.0b1 + ubuntu0.16.4.8
python-dateutil 2.4.2
python-debian 0.1.27
python-systemd 231
pytz 2020.1
PyYAML 3.11
要求2.9.1
罗马2.0.0
rsa 3.2.3
s3transfer 0.3.3
设置工具46.2.0
六个1.10.0
雪花连接器Python 2.2.6
ssh-import-id 5.5
友联0.35
无人值守升级0.1
urllib3 1.25.9
轮0.34.2
我正在使用雪花文档中提到的示例python代码 https://docs.snowflake.com/en/user-guide/python-connector-install.html#step-2-verify-your-installation
这是错误:-
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.5/site-packages/snowflake/connector/network.py", line 799, in _request_exec
auth=SnowflakeAuth(token),
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 480, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 588, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 376, in send
timeout=timeout
File "/home/ubuntu/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 677, in urlopen
chunked=chunked,
File "/home/ubuntu/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 381, in _make_request
self._validate_conn(conn)
File "/home/ubuntu/.local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 976, in _validate_conn
conn.connect()
File "/home/ubuntu/.local/lib/python3.5/site-packages/urllib3/connection.py", line 370, in connect
ssl_context=context,
File "/home/ubuntu/.local/lib/python3.5/site-packages/snowflake/connector/ssl_wrap_socket.py", line 411, in ssl_wrap_socket_with_ocsp
).validate(server_hostname, ret.connection)
AttributeError: 'SSLSocket' object has no attribute 'connection'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.5/site-packages/snowflake/connector/network.py", line 649, in _request_exec_wrapper
**kwargs)
File "/home/ubuntu/.local/lib/python3.5/site-packages/snowflake/connector/network.py", line 892, in _request_exec
raise RetryRequest(err)
snowflake.connector.network.RetryRequest: 'SSLSocket' object has no attribute 'connection'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ubuntu/infaagent/apps/Data_Integration_Server/data/Scripts/test1.py", line 9, in <module>
account='qsdunitydev'
File "/home/ubuntu/.local/lib/python3.5/site-packages/snowflake/connector/__init__.py", line 53, in Connect
return SnowflakeConnection(**kwargs)
File "/home/ubuntu/.local/lib/python3.5/site-packages/snowflake/connector/connection.py", line 189, in __init__
self.connect(**kwargs)
File "/home/ubuntu/.local/lib/python3.5/site-packages/snowflake/connector/connection.py", line 493, in connect
self.__open_connection()
File "/home/ubuntu/.local/lib/python3.5/site-packages/snowflake/connector/connection.py", line 710, in __open_connection
self.__authenticate(auth_instance)
File "/home/ubuntu/.local/lib/python3.5/site-packages/snowflake/connector/connection.py", line 964, in __authenticate
session_parameters=self._session_parameters,
File "/home/ubuntu/.local/lib/python3.5/site-packages/snowflake/connector/auth.py", line 216, in authenticate
socket_timeout=self._rest._connection.login_timeout)
File "/home/ubuntu/.local/lib/python3.5/site-packages/snowflake/connector/network.py", line 530, in _post_request
_include_retry_params=_include_retry_params)
File "/home/ubuntu/.local/lib/python3.5/site-packages/snowflake/connector/network.py", line 609, in fetch
**kwargs)
File "/home/ubuntu/.local/lib/python3.5/site-packages/snowflake/connector/network.py", line 692, in _request_exec_wrapper
conn, full_url, cause)
File "/home/ubuntu/.local/lib/python3.5/site-packages/snowflake/connector/network.py", line 722, in handle_invalid_certificate_error
u'errno': ER_FAILED_TO_REQUEST,
File "/home/ubuntu/.local/lib/python3.5/site-packages/snowflake/connector/errors.py", line 100, in errorhandler_wrapper
connection.errorhandler(connection, cursor, errorclass, errorvalue)
File "/home/ubuntu/.local/lib/python3.5/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: 'SSLSocket' object has no attribute 'connection'
答案 0 :(得分:8)
您可以运行以下命令来更新请求,然后尝试
pip3安装请求== 2.23.0
还请尽可能将Python版本升级到3.7,并检查问题是否仍然存在。