pyspark - SparkSQL read from MySQL database table using Python -
this question has answer here:
- how work mysql , apache spark? 10 answers
i have 'user' table in mysql. want read spark sql program. how can read table mysql apache spark's sparksql module using python? there connector can use task? thanks.
there similar question answered. start pyspark
this
./bin/pyspark --packages mysql:mysql-connector-java:5.1.38
then run
sqlcontext.read.format("jdbc").options( url ="jdbc:mysql://localhost/mysql", driver="com.mysql.jdbc.driver", dbtable="user", user="root", password="" ).load().take(10)
this work. depends on mysql set-up, if doesn't try changing password, username, db-url , other settings.
Comments
Post a Comment