Spark with Postgres SQL fetches only the column names and not the values

Viewed 35

I have a table like this.

ID   Name
---------
1   "Dummy"
1   "Dummy"

When I use the following Java code to fetch the 2 entries, it is printing only the ID and Name and not it's values.

Dataset<Row> row = sparkSession.read().format("jdbc")
                .option("url", "jdbc:postgresql://localhost:5432/postgres").option("user", "postgres").option("password","pass@1")
                .option("dbtable", "public.\"Employee\"") 
                .option("query", "select * from public.\"Employee\"")
                .option("fetchsize", "10")
                .load();
0 Answers
Related