使用 Glue 连接和 spark scala 覆盖 Mysql table
Overwrite Mysql table using Glue connection and spark scala
是否可以使用预定义的连接在 aws glue 作业中执行预操作查询?
或者如何使用 glueContext.getJDBCSink?
覆盖 mysql table 中的数据
我要执行的代码是
val datasink4 = glueContext.getJDBCSink(
catalogConnection = "xxxxx_mysql",
options = JsonOptions(
"""{"dbtable": "xxxxx.role_code_se",
"database": "xxxxx",
"preactions": "TRUNCATE TABLE xxxxx.role_code_se;",
"overwrite": "true"}"""
),
redshiftTmpDir = "", transformationContext = "datasink4"
).writeDynamicFrame(new_dynamic_frame)
但它不起作用。它忽略覆盖和截断选项并抛出错误
java.sql.BatchUpdateException: Duplicate entry '31' for key 'ix_role_code_se_role_code' at
是否可以使用预定义的连接在 aws glue 作业中执行预操作查询? 或者如何使用 glueContext.getJDBCSink?
覆盖 mysql table 中的数据我要执行的代码是
val datasink4 = glueContext.getJDBCSink(
catalogConnection = "xxxxx_mysql",
options = JsonOptions(
"""{"dbtable": "xxxxx.role_code_se",
"database": "xxxxx",
"preactions": "TRUNCATE TABLE xxxxx.role_code_se;",
"overwrite": "true"}"""
),
redshiftTmpDir = "", transformationContext = "datasink4"
).writeDynamicFrame(new_dynamic_frame)
但它不起作用。它忽略覆盖和截断选项并抛出错误
java.sql.BatchUpdateException: Duplicate entry '31' for key 'ix_role_code_se_role_code' at