Python 3.8 Snowflake Connection Error : snowflake.connector.errors.OperationalError: 250003: 250003

Python 3.8 Snowflake Connection Error : snowflake.connector.errors.OperationalError: 250003: 250003

Failed to get the response. Hanging? method: post, url: https://ABC.us-east-2.aws.snowflakecomputing.com:443/session/v1/login-request?request_id=efabf1c7-7fb6-48cb-a50e-256967e3de45&databaseName=DATAVAULT&schemaName=STAGE&warehouse=DATAVAULT&roleName=TEST_Admin&request_guid=c99547cd-ceeb-4280-845b-f2de7be76755

在 Windows Python 3.8

上出现连接错误

连接参数

{
    "user" : "TestUser1",
    "password" : "XXXX",
    "account" : "ABC.us-east-2.aws",
    "warehouse" : "DATAVAULT",
    "database" : "DATAVAULT",
    "schema" : "STAGE",
    "Role" : "Test_role"
}

还尝试将帐户名称设为“ABC”、“ABC.aws”,但没有成功

代码:

    import snowflake.connector as snow

    conn = snow.connect(user=self.user,
      password= self.password,
      account= self.account,
      warehouse=self.warehouse,
          database=self.database,
      schema=self.schema,
      role=self.role
      )
    cur = conn.cursor()

相同的代码在 Linux 中运行良好,但在 Python 的 Windows 版本中运行不佳。 如下添加代理但没有帮助

os.environ['HTTP_PROXY'] = "http://http-proxy.company.com:80"
os.environ['HTTPS_PROXY'] = "https://http-proxy.company.com:443"

===================================== 使用 sqlalchemy

import os 

os.environ['HTTP_PROXY'] = "http://http-proxy.xxx.com:80"
os.environ['HTTPS_PROXY'] = "https://https-proxy.xxx.com:443"

from sqlalchemy import create_engine
from snowflake.sqlalchemy import URL
import os
import sys



url = URL(
    account = 'xxxx.us-east-2.aws',
    user = 'TestUser1',
    database = 'DATAVAULT' ,
    schema = 'STAGE',
    warehouse= 'DATAVAULT',
    role = 'DV_Admin',
    password='xxxx', # note my passsword has a '@' in it 
)
print(os.environ['HTTP_PROXY'])
print(os.environ['HTTPS_PROXY'])


engine = create_engine(url)
print(engine)
results = engine.execute('select current_version()').fetchone()
sys.exit()
try:
    results = engine.execute('select current_version()').fetchone()
    assert results is not None
finally:
    engine.dispose()

修复 Wifi 代理和钥匙链文件后,我可以从 MAC 进行连接。