from pyspark.sql import SparkSession from pyspark.conf import SparkConf from pyspark.sql import SQLContext conf = SparkConf().setAppName(‘数据总览‘) spark = SparkSession.builder.config(conf=conf).enableHiveSupport().getOrCreate() url = ‘jdbc:mysql://172.10.2.70:3306/trancare_spd_q?useSSL=false‘ ctx = SQLContext(spark) df1 = ctx.read.format(‘jdbc‘).options(url=url, driver="com.mysql.jdbc.Driver",dbtable="f_local_app_perm_rate_rank",user="trancare",password="trancare").load() df1.show()