Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pyspark.sql import SparkSession
- spark = SparkSession
- .builder
- .appName("spark play")
- .getOrCreate()
- df = spark.read
- .format("jdbc")
- .option("url", "jdbc:mysql://localhost:port")
- .option("dbtable", "schema.tablename")
- .option("user", "username")
- .option("password", "password")
- .load()
- ...
- .option("dbtable", "(SELECT foo, bar FROM schema.tablename) AS tmp")
- ...
Add Comment
Please, Sign In to add comment