Connection issue: Databricks - Snowflake

Viewed 354

I am trying to connect to Snowflake from Databricks Notebook through externalbrowser authenticator but without any success.

CMD1
sfOptions = {
 "sfURL" : "xxxxx.west-europe.azure.snowflakecomputing.com",
 "sfAccount" : "xxxxx",
 "sfUser" : "ivan.lorencin@xxxxx",
 "authenticator" : "externalbrowser",
 "sfPassword" : "xxxxx",
 "sfDatabase" : "DWH_PROD",
 "sfSchema" : "APLSDB",
 "sfWarehouse" : "SNOWFLAKExxxxx",
 "tracing" : "ALL",
}
 
SNOWFLAKE_SOURCE_NAME = "net.snowflake.spark.snowflake"

CMD2
df = spark.read.format(SNOWFLAKE_SOURCE_NAME) \
   .options(**sfOptions) \
   .option("query",  "select 1 as my_num union all select 2 as my_num") \
   .load()

And CMD2 is not completed but I am receiving ".. Running command ..." that last forever.

enter image description here

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

1 Answers

It looks like you're setting Authenticator to externalbrowser, but according to the docs it should be sfAuthenticator - is this intentional? If you are trying to do an OAuth type of auth, why do you also have password?

If you're account/user requires OAuth to login, I'd remove that password entry from sfOptions, edit that one entry to sfAuthenticator and try again.

If that does not work, you should ensure that your Spark cluster can reach out to all the required Snowflake hosts (see SnowCD for assistance).

Related