You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Saulo Ricci <in...@gmail.com> on 2017/05/01 19:49:00 UTC

Loading postgresql table to spark SyntaxError

Hi,

the following code is reading a table from my postgresql database, and I'm
following the directives I've read on the internet:

    val txs = spark.read.format("jdbc").options(Map(
    ("driver" -> "org.postgresql.Driver"),
    ("url" -> "jdbc:postgresql://host/dbname"),
    ("dbtable" -> "(select field1 from t) as table1"),
    ("user" -> "username"),
    ("password" -> "password"))).load()

I'm running this query on a jupyter notebook but I'm getting the SyntaxError
as message but no clue about the stacktrace.

I'm assuming that query was right as I saw similar queries working with
other people.

Any help is appreciate to try to understand how to fix this issue.

-- 
Saulo