本文整理了Java中org.apache.spark.sql.DataFrameWriter.jdbc()
方法的一些代码示例,展示了DataFrameWriter.jdbc()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataFrameWriter.jdbc()
方法的具体详情如下:
包路径:org.apache.spark.sql.DataFrameWriter
类名称:DataFrameWriter
方法名:jdbc
暂无
代码示例来源:origin: XavientInformationSystems/Data-Ingestion-Platform
public void write(List<Row> rows, StructType schema, String tableName) {
if (CollectionUtils.isNotEmpty(rows))
sqlContext.createDataFrame(rows, schema).write().mode(SaveMode.Overwrite).jdbc(props.getProperty("url"),
tableName, props);
}
}
代码示例来源:origin: cloudera-labs/envelope
@Override
public void applyBulkMutations(List<Tuple2<MutationType, Dataset<Row>>> planned) {
Properties properties = new Properties();
properties.put("user",username);
properties.put("password",password);
for (Tuple2<MutationType, Dataset<Row>> plan : planned) {
MutationType mutationType = plan._1();
Dataset<Row> mutation = plan._2();
switch (mutationType) {
case INSERT:
mutation.write().jdbc(url, tableName, properties);
break;
default:
throw new RuntimeException("JDBC output does not support mutation type: " + mutationType);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!