想要将mysql连接到spark。显示此错误:
回溯(最近通话最近):文件 “ /home/ewebcore/Desktop/spark_prgm/spark_sql_connect.py”,第10行,在
df = SQLContext.read.format(“ jdbc”)。options(AttributeError:'property'对象没有属性'format'
from pyspark.sql import SQLContext
from pyspark.sql.session import SparkSession
from pyspark.sql.types import *
from pyspark import SparkContext, SparkConf, StorageLevel
df = SQLContext.read.format("jdbc").options(
url="jdbc:mysql://localhost:3306/Demo",
driver = "com.mysql.jdbc.Driver",
dbtable = "Bank",
user="root",
password="*******").load()`