Advertisement
Guest User

Untitled

a guest
Jun 20th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. url =
  2. "jdbc:postgresql://localhost:5432/mydatabase?user=postgres"
  3.  
  4. df = sqlContext
  5. .read
  6. .format("jdbc")
  7. .option("url", url)
  8. .option("dbtable", "accounts")
  9. .option("partitionColumn", "id")
  10. .option("numPartitions", 10)
  11. .option("lowerBound", 1)
  12. .option("upperBound", 50000000)
  13. .option("password", "password")
  14. .load()
  15.  
  16. results = df.map(lambda row: row["name"]).filter(lambda name: "taco" in name).collect()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement