Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(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 IGNORE 或 INSERT 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 选项是忽略整个事务还是只是有问题的行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Pyspark DataFrameWriter jdbc 函数的 ignore 选项是忽略整
基础教程推荐
- 无法解决整理冲突 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- 在 SQL 中连接多个表 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
