📜  将 spark 连接到 postgres;将 spark 连接到数据库 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:03.991000             🧑  作者: Mango

代码示例1
spark = SparkSession.builder.config(conf=spark_conf).getOrCreate()

#make sure the necessary jar files are loaded
#@ opt/spark/jars folder

df = spark.read \
    .format("jdbc") \
    .option("url", "jdbc:postgresql://:/") \
    .option("dbtable", ".") \
    .option("user", "") \
    .option("password", "") \
    .option("driver", "org.postgresql.Driver") \
    .load()