简体   繁体   English

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

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

I'm trying to connect to snowflake from Python using AzureAD login with the following code:我正在尝试使用 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()    

But I'm getting this error:但我收到了这个错误:

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

Any idea of what I have to do?知道我必须做什么吗?

Your account should be like this:您的帐户应该是这样的:

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

You're missing cloud provider at the end of the account name.您在帐户名称的末尾缺少云提供商。 See the account name examples here:在此处查看帐户名称示例:

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

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

相关问题 如何在 Python 3 中的 Databricks 中使用 python 雪花连接器连接到雪花? - How to connect to Snowflake using python snowflake connector from within Databricks in Python 3? 尝试使用 Python 和 Snowflake-Connector 使用 Excel 列表中的值列表查询 Snowflake - Trying to query Snowflake with a list of values from an Excel List using Python and Snowflake-Connector 尝试使用selenium和python登录网页时出错 - Error trying to login to webpage using selenium with python Python:如何使用 Apache Beam 连接到 Snowflake? - Python: How to Connect to Snowflake Using Apache Beam? 如何使用 SSO(sqlalchemy)将 python 连接到雪花? - How to connect python to Snowflake using SSO (sqlalchemy)? 在 Python 中连接雪花 - Connect Snowflake in Python 使用 python 雪花连接器从雪花表中获取列 header - Getting column header from snowflake table using python snowflake connector 尝试使用 Python 请求登录网站时响应 403 错误 - Response 403 Error When Trying to Login To Website Using Python Requests 尝试使用python中的套接字连接到服务器进行下一次连接时发生错误 - error when trying to connect to server for next the connection using sockets in python 尝试使用 pyodbc 使用 python 连接到 sql server 时出错 - Error while trying to connect to sql server with python using pyodbc
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM