0

I am trying to connect to snowflakes from databricks. I tried number of methods but without any success.

Method I

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

error

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

Method II

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

Error

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

Can anybody help what is going wrong here? How can I establish a connection?

Thanks in advance

James Taylor
  • 484
  • 1
  • 8
  • 23
  • 2
    It could be a lack of the snowflake account_id in the url you added to connect. THey are normally of the form `..snowflakecomputing.com` – Blokje5 May 11 '20 at 08:06
  • Blokje5, it seems you answered the question, maybe you can post it as an answer (instead of comment) – Gokhan Atil May 11 '20 at 09:02

1 Answers1

0

Sharing the answer as per the comment by the @Blokje5.

It could be a lack of the snowflake account_id in the url you added to connect. THey are normally of the form <account-id>.<region>.snowflakecomputing.com

CHEEKATLAPRADEEP
  • 12,191
  • 1
  • 19
  • 42