0

我正在尝试从数据块连接到雪花。我尝试了多种方法,但没有任何成功。

方法一

# snowflake connection options
options = dict(sfUrl="eu-west-1.snowflakecomputing.com",
               sfUser= "snowflake_usr",
               sfPassword="snowflake_pwd",
               sfDatabase="pm",
               sfSchema="public",
               sfWarehouse="ds"
              )

# Read the data written by the previous cell back.
df = spark.read \
  .format("snowflake") \
  .options(**options) \
  .option("dbtable", "pm") \
  .load()

display(df)

错误

4JJavaError                             Traceback (most recent call last)
<command-37988> in <module>
      3   .format("snowflake") \
      4   .options(**options) \
----> 5   .option("dbtable", "pm") \
      6   .load()

方法二

OKTA_USER = 'okta_user'
OKTA_PASSWORD = 'okta_pwd'
con = snowflake.connector.connect(
  user= OKTA_USER,
  password= OKTA_PASSWORD,
  account='eu-west-1.snowflakecomputing.com',
  authenticator='https://okta-emea.com/',
  warehouse='ds',
  database='pm',
  schema='public'
)

错误

OperationalError: 250003: Failed to execute request: HTTPSConnectionPool(host='https', port=443): Max retries exceeded with url: eu-west-1.snowflakecomputing.com.snowflakecomputing.com:443/session/authenticator-request (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f39d82aae48>: Failed to establish a new connection: [Errno -2] Name or service not known'))

任何人都可以帮助这里出了什么问题吗?如何建立连接?

提前致谢

4

1 回答 1

0

根据@Blokje5 的评论分享答案。

可能是您添加连接的 url 中缺少雪花 account_id。它们通常是以下形式<account-id>.<region>.snowflakecomputing.com

于 2020-06-04T08:02:11.830 回答