Guest User

Untitled

a guest
Aug 24th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. from pyspark.sql import SparkSession
  2.  
  3. spark = SparkSession
  4. .builder
  5. .appName("spark play")
  6. .getOrCreate()
  7.  
  8. df = spark.read
  9. .format("jdbc")
  10. .option("url", "jdbc:mysql://localhost:port")
  11. .option("dbtable", "schema.tablename")
  12. .option("user", "username")
  13. .option("password", "password")
  14. .load()
  15.  
  16. ...
  17. .option("dbtable", "(SELECT foo, bar FROM schema.tablename) AS tmp")
  18. ...
Add Comment
Please, Sign In to add comment