create database test_db;
create table t_random as select s, md5(random()::text) from generate_Series(1,5000) s;
In [1]: df=spark.read.jdbc(url="jdbc:postgresql://localhost:5432/test_db", table="t_random", properties={"driver": "org.postgresql.Driver"}).repartition(10)