如何将 Apache Spark 与 MySQL 集成以将数据库表作为 Spark 数据帧读取? [英] How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?

查看:25
本文介绍了如何将 Apache Spark 与 MySQL 集成以将数据库表作为 Spark 数据帧读取?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 Apache Spark 和 MySQL 运行我现有的应用程序.

I want to run my existing application with Apache Spark and MySQL.

推荐答案

来自 pySpark,它对我有用:

From pySpark, it work for me :

dataframe_mysql = mySqlContext.read.format("jdbc").options(
    url="jdbc:mysql://localhost:3306/my_bd_name",
    driver = "com.mysql.jdbc.Driver",
    dbtable = "my_tablename",
    user="root",
    password="root").load()

这篇关于如何将 Apache Spark 与 MySQL 集成以将数据库表作为 Spark 数据帧读取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆