避免在目标表中没有唯一约束的重复插入? [英] Avoid duplicate inserts without unique constraint in target table?

查看:25
本文介绍了避免在目标表中没有唯一约束的重复插入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来源&目标表类似.

Source & target tables are similar.

目标表有一个在 tMap 中计算的 UUID 字段,但是流程不应在目标中插入重复的人,即唯一的(名字、姓氏、dob、性别).我尝试在 tMap 中将这些列标记为 key ,如下面的屏幕截图所示,但这并不能防止重复插入.如何避免重复插入而不在目标上添加唯一约束?

Target table has a UUID field that is computed in tMap, however the flow should not insert duplicate persons in target i.e unique (firstname,lastname,dob,gender). I tried marking those columns as key in tMap as in below screenshot, but that does not prevent duplicate inserts. How can I avoid duplicate inserts without adding unique constraint on target?

我也尝试过在目标中使用字段".

I also tried "using field" in target.

解决方案如下:

推荐答案

Talend Studio for Data Integration 的付费版本中的 CDC 组件无疑解决了这个问题.

The CDC components in the Paid version of Talend Studio for Data Integration undoubtedly address this.

在 Open Studio 中,您可以根据复合的唯一键(名字、姓氏、dob、性别)滚动自己的变更数据捕获.

In Open Studio, you'll can roll your own Change data capture based on the composite, unique key (firstname,lastname,dob,gender).

  • 对来自 stage_geno_patients 的数据使用 tUniqueRow,在以下列中唯一:firstname、lastname、dob、gender
  • 将其输入到 tMap 中
  • 添加另一个查询作为 tMap 的输入,对patients_test"后面的表执行查找,以查找名字、姓氏、dob、gender 的匹配项.该查找应该使用从暂存行中查找值来重新加载每一行"
  • 在不匹配的情况下,检测它,然后将暂存数据行插入到patients_test"后面的表中

问:你们也会更新信息吗?或者,目标是否只是在数据不存在的情况下执行唯一插入?

Q: Are you going to update information, also? Or, is the goal only to perform unique inserts where the data is not already present?

这篇关于避免在目标表中没有唯一约束的重复插入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆