繁体   English   中英

尝试使用 AzureAD 登录从 python 连接到雪花时出错

[英]Error trying to connect to snowflake from python using the AzureAD login

我正在尝试使用 AzureAD 登录并使用以下代码从 Python 连接到雪花:

import os
os.system('python -m pip install --upgrade pip')
os.system('pip install -r https://raw.githubusercontent.com/snowflakedb/snowflake-connector-python/v2.4.2/tested_requirements/requirements_38.reqs')
os.system('pip install snowflake-connector-python==2.4.2')
os.system('pip install "snowflake-connector-python[secure-local-storage]"')

    ctx = snowflake.connector.connect(
    user='xxxx@mydomain.com',
    password='xxxxx',
    host='<xxxx.east-us-2.azure.snowflakecomputing.com',
    account='xxxx.east-us-2',
    authenticator='externalbrowser',
    warehouse='xxxx'
    )
cs = ctx.cursor()
try:
    cs.execute("SELECT * FROM TABLE")
    rows = cs.fetchall()
    for row in rows:
        print(row)
finally:
    cs.close()
ctx.close()    

但我收到了这个错误:

OperationalError: 250003: Failed to execute request: HTTPSConnectionPool(host='%xxxxx.east-us-2.azure.snowflakecomputing.com', port=443): Max retries exceeded with url: /session/authenticator-request?request_guid=3ba50eab-2575-4ceb-a658-922c51d94a1b (Caused by NewConnectionError('<snowflake.connector.vendored.urllib3.connection.HTTPSConnection object at 0x000001E1139BA9D0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

知道我必须做什么吗?

您的帐户应该是这样的:

account='xxxx.east-us-2.azure'

您在帐户名称的末尾缺少云提供商。 在此处查看帐户名称示例:

https://docs.snowflake.com/en/user-guide/python-connector-install.html#step-2-verify-your-installation

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM