pyspark - SparkSQL read from MySQL database table using Python -


this question has answer here:

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

Popular posts from this blog

php - How to register a post type and taxonomy in WordPress and display in a page/single post -

database - How many Observations in SAS Sample Data Output -

emulation - Android map show my location didn't work -