我正在尝试连接(PySpark + Snowflake)不断收到错误。
我正在使用 PySpark 3.1、JDBC 和 Spark_Snowflake jar 文件也放置在 Classpath 中。不知道为什么我收到以下错误。
代码:
from pyspark import SparkConf, SparkContext
from pyspark.sql import SQLContext
from pyspark.sql.types import *
from pyspark import SparkConf, SparkContext
sc = SparkContext("local", "Test App")
spark = SQLContext(sc)
spark_conf = SparkConf().setMaster('local').setAppName('Testing Spark SF')
sfOptions = {
"sfURL" : "<account_identifier>.snowflakecomputing.com",
"sfUser" : "<user_name>",
"sfPassword" : "<password>",
"sfDatabase" : "<database>",
"sfSchema" : "<schema>",
"sfWarehouse" : "<warehouse>"
}
SNOWFLAKE_SOURCE_NAME = "net.snowflake.spark.snowflake"
df = spark.read.format(SNOWFLAKE_SOURCE_NAME) \
.options(**sfOptions) \
.option("query", "select 1 as my_num union all select 2 as my_num") \
.load()
df.show()
错误:
Py4JJavaError:调用 o37.load 时出错。:net.snowflake.client.jdbc.SnowflakeSQLException:JDBC驱动遇到通信错误。消息:HTTP 请求遇到异常:sun.security.validator.ValidatorException:未找到受信任的证书。在 net.snowflake.client.jdbc.RestRequest.execute(RestRequest.java:284) 在 net.snowflake.client.core.HttpUtil.executeRequestInternal(HttpUtil.java:639) 在 net.snowflake.client.core.HttpUtil.executeRequest (HttpUtil.java:584) 在 net.snowflake.client.core.HttpUtil.executeGeneralRequest(HttpUtil.java:551) 在 net.snowflake.client.core.SessionUtil.newSession(SessionUtil.java:587) 在 net.snowflake。 client.core.SessionUtil.openSession(SessionUtil.java:285) 在 net.snowflake.client.core.SFSession.open(SFSession.java:446) 在 net.snowflake.client.jdbc.DefaultSFConnectionHandler。