How to read MySql table in PySpark?

PySpark supports many data sources. Below are some samples.

CSV, JSON,ORC,Parquet, JDBC and etc...

Here is an example to read the data from MySql.







Code : spark.read.format("jdbc").options(url="jdbc:mysql://localhost:3306/employees?useSSL=false&user=root&password=mehaa1903",dbtable="departments").load().show()



No comments:

Post a Comment