Connectez Spark à Postgres; Connectez Spark à la base de données

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://<host>:<port>/<db_name>") \
    .option("dbtable", "<schema>.<tablename>") \
    .option("user", "<username>") \
    .option("password", "<password>") \
    .option("driver", "org.postgresql.Driver") \
    .load()
sivakguru