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

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -