Python 3.8 雪花连接错误:snowflake.connector.errors.OperationalError:250003:250003

时间:2021-07-13 08:57:18

标签: python connection snowflake-cloud-data-platform

<块引用>

未能得到响应。绞刑?方法:发布,网址: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 上运行良好,但不适用于 Windows 版本的 Python。 添加代理如下但没有帮助

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()

1 个答案:

答案 0 :(得分:0)

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