I use PySpark in my system. I got the warninig: context.py:79: FutureWarning: Deprecated in 3.0.0. Use SparkSession.builder.getOrCreate() instead.
my script:
scSpark = SparkSession.builder.config("spark.driver.extraClassPath", "./mysql-connector-java-8.0.29.jar").getOrCreate()
sqlContext = SQLContext(scSpark)
jdbc_url = "jdbc:mysql://{0}:{1}/{2}".format(hostname, jdbcPort, dbname)
connectionProperties = {
"user": username,
"password": password
}
#df=scSpark.read.jdbc(url=jdbc_url, table='bms_title', properties= connectionProperties)
#df.show()
df = scSpark.read.csv(data_file, header=True, sep=",", encoding='UTF-8').cache()
df2 = df.first()
df = df.exceptAll(scSpark.createDataFrame([df2]))
df.createTempView("books")
output = scSpark.sql('SELECT `Postgraduate Course` AS Postgraduate_Course FROM books'))
Why I got this warning as I have already used SparkSession.builder.getOrCreate() How could I correct this warning?