I'm running simple code to write dataframe to the MySql db
val mydf = //.. create some dataframe
mydf
.write
.format("jdbc")
.option("driver", "com.mysql.jdbc.Driver")
.option("url",url)
.option("dbtable",table)
.mode(SaveMode.Append)
.save();
And as a result getting following error
Caused by: java.sql.SQLException: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
Tried to add additional property, but it seems spark is ignoring that.option(BINLOG_FORMAT,"MIXED")
Is there an option to set some property on spark level and not change the database definition?
There is no option specified in spark documentation to change BINLOG_FORMAT
. You can check the possible optionshere .
From the exception message:
InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
READ_UNCOMMITTED
is the default isolation in spark. You can try changing this option.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.