Pyspark DataFrameWriter jdbc 函数的 ignore 选项是忽略整

Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函数的 ignore 选项是忽略整个事务还是只是有问题的行?)
本文介绍了Pyspark DataFrameWriter jdbc 函数的 ignore 选项是忽略整个事务还是只是有问题的行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Pyspark DataFrameWriter 类有一个 jdbc 函数 用于将数据帧写入 sql.这个函数有一个 --ignore 选项,文档说:

The Pyspark DataFrameWriter class has a jdbc function for writing a dataframe to sql. This function has an --ignore option that the documentation says will:

如果数据已经存在,则静默忽略此操作.

Silently ignore this operation if data already exists.

但是它会忽略整个事务,还是只会忽略插入重复的行?如果我将 --ignore--append 标志结合起来会怎样?行为会改变吗?

But will it ignore the entire transaction, or will it only ignore inserting the rows that are duplicates? What if I were to combine --ignore with the --append flag? Would the behavior change?

推荐答案

mode("ingore") 如果表(或另一个接收器)已经存在并且无法组合写入模式,则只是 NOOP.如果您正在寻找诸如 INSERT IGNOREINSERT INTO ... WHERE NOT EXISTS ... 之类的内容,则必须手动执行,例如使用 mapPartitions.

mode("ingore") is just NOOP if table (or another sink) already exists and writing modes cannot be combined. If you're looking for something like INSERT IGNORE or INSERT INTO ... WHERE NOT EXISTS ... you'll have to do it manually, for example with mapPartitions.

这篇关于Pyspark DataFrameWriter jdbc 函数的 ignore 选项是忽略整个事务还是只是有问题的行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)
SQL/MySQL: split a quantity value into multiple rows by date(SQL/MySQL:按日期将数量值拆分为多行)