Using pyspark to connect to PostgreSQL

前端 未结 10 1432
逝去的感伤
逝去的感伤 2020-12-01 04:50

I am trying to connect to a database with pyspark and I am using the following code:

sqlctx = SQLContext(sc)
df = sqlctx.load(
    url = "jdbc:postgresql         


        
10条回答
  •  我在风中等你
    2020-12-01 05:12

    You normally need either:

    1. to install the Postgres Driver on your cluster,
    2. to provide the Postgres driver jar from your client with the --jars option
    3. or to provide the maven coordinates of the Postgres driver with --packages option.

    If you detail how are you launching pyspark, we may give you more details.

    Some clues/ideas:

    spark-cannot-find-the-postgres-jdbc-driver

    Not able to connect to postgres using jdbc in pyspark shell

提交回复
热议问题