Skip to content
This repository has been archived by the owner on Oct 18, 2021. It is now read-only.

Commit

Permalink
Merge pull request #98 from Codelone/master-dev
Browse files Browse the repository at this point in the history
use MySQLReader  executor sentence sql
  • Loading branch information
Nicole00 authored Jun 16, 2021
2 parents 052daf9 + a3aa765 commit 14c9d4f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,15 @@ class MySQLReader(override val session: SparkSession, mysqlConfig: MySQLSourceCo
override def read(): DataFrame = {
val url =
s"jdbc:mysql://${mysqlConfig.host}:${mysqlConfig.port}/${mysqlConfig.database}?useUnicode=true&characterEncoding=utf-8"
session.read
val df = session.read
.format("jdbc")
.option("url", url)
.option("dbtable", mysqlConfig.table)
.option("user", mysqlConfig.user)
.option("password", mysqlConfig.password)
.load()
df.createOrReplaceTempView(mysqlConfig.table)
session.sql(sentence)
}
}

Expand Down

0 comments on commit 14c9d4f

Please sign in to comment.