Snowflake.connector.errors.OperationalError:250003:无法获取响应

Jan*_*ini 7 snowflake-cloud-data-platform python-3.8

我尝试使用未启用 MFA 的帐户从 Python 建立与 Snowflake 的连接,但未建立连接。我已附上代码和日志。

from sqlalchemy import create_engine
from snowflake.sqlalchemy import URL
from sqlalchemy.orm import sessionmaker

# # create connection object wih the
# # Bridg provided snowflake connection details provided
sf_engine = create_engine(URL(
         account='xxxx',
         user='xxx',
         password='xxxx',
         database='xxx',
         schema='xxx',
         warehouse='xxx',
         role='xxx',
))
Session = sessionmaker(bind=sf_engine, autocommit=False)
session = Session()
results = session.execute("desc view xxx.xxx.TRANSACTION;")
print(results)
Run Code Online (Sandbox Code Playgroud)
/opt/anaconda3/bin/python /Users/jpriyad/Documents/pythonProject/connect/snow.py
Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.8/site-packages/snowflake/connector/connection.py", line 1014, in __authenticate
    auth.authenticate(
  File "/opt/anaconda3/lib/python3.8/site-packages/snowflake/connector/auth.py", line 257, in authenticate
    ret = self._rest._post_request(
  File "/opt/anaconda3/lib/python3.8/site-packages/snowflake/connector/network.py", line 700, in _post_request
    ret = self.fetch(
  File "/opt/anaconda3/lib/python3.8/site-packages/snowflake/connector/network.py", line 790, in fetch
    ret = self._request_exec_wrapper(
  File "/opt/anaconda3/lib/python3.8/site-packages/snowflake/connector/network.py", line 912, in _request_exec_wrapper
    raise e
  File "/opt/anaconda3/lib/python3.8/site-packages/snowflake/connector/network.py", line 844, in _request_exec_wrapper
    self._handle_unknown_error(method, full_url, headers, data, conn)
  File "/opt/anaconda3/lib/python3.8/site-packages/snowflake/connector/network.py", line 944, in _handle_unknown_error
    Error.errorhandler_wrapper(
  File "/opt/anaconda3/lib/python3.8/site-packages/snowflake/connector/errors.py", line 269, in errorhandler_wrapper
    handed_over = Error.hand_to_other_handler(
  File "/opt/anaconda3/lib/python3.8/site-packages/snowflake/connector/errors.py", line 327, in hand_to_other_handler
    connection.errorhandler(connection, cursor, error_class, error_value)
  File "/opt/anaconda3/lib/python3.8/site-packages/snowflake/connector/errors.py", line 203, in default_errorhandler
    raise error_class(
snowflake.connector.errors.OperationalError: 250003: Failed to get the response. Hanging? method: post, url: https://xxxx.snowflakecomputing.com:443/session/v1/login-request?request_id=828cc997-d9a1-4d29-b70f-4dab2045d18f&databaseName=xxx&schemaName=xxx&warehouse=xxx&roleName=xxx&request_guid=xxxx

During handling of the above exception, another exception occurred:


  File "/opt/anaconda3/lib/python3.8/site-packages/snowflake/connector/auth_by_plugin.py", line 117, in handle_timeout
    raise OperationalError(
sqlalchemy.exc.OperationalError: (snowflake.connector.errors.OperationalError) 250001: Could not connect to Snowflake backend after 0 attempt(s).Aborting
(Background on this error at: https://sqlalche.me/e/14/e3q8)

Process finished with exit code 1
Run Code Online (Sandbox Code Playgroud)

Muk*_*mar 14

我有一段时间面临同样的问题。我花了很长时间调试它。

解决方案:

重新检查您传递的凭据account

凭证错误 =>account = 'xyz.us-east-1.snowflakecomputing.com'

正确的凭证 =>account = 'xyz.us-east-1'

这里us-east-1是AWS区域。对你来说可能会有所不同。

基本上,不要传递snowflakecomputing.com帐户凭据。

  • `https://` 和 `.snowflakecomputing.com` 之间的所有内容 (2认同)