Answers for "connect spark to postgres; connect spark to database"

0

connect spark to postgres; connect spark to database

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()
Posted by: Guest on September-03-2021

Code answers related to "connect spark to postgres; connect spark to database"

Python Answers by Framework

Browse Popular Code Answers by Language