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

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

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