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

libGdx unable to find files in android application data directory -

php - Webix Data Loading from Laravel Link -

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