Informatica - 重复消除

发布于 2024-12-29 14:14:08 字数 151 浏览 1 评论 0原文

我有一个包含 10 条记录的平面文件,其中 5 条记录是重复记录(唯一键列:Customer_Idsource_system)。该平面文件必须加载到 Oracle 表,这是第一次加载。

我怎样才能消除其中的重复项?

I am having a flat file with 10 records, and out of it 5 records are duplicate records (unique key column: Customer_Id and source_system). This flat file has to load to a Oracle table and this is the first load.

How can I eliminate the duplicates in it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

[浮城] 2025-01-05 14:14:08

有很多方法可以处理此问题:

  1. 将数据加载到临时表,然后仅选择不同的记录
  2. 使用排序器或聚合器转换,然后选择不同的选项(如果我没记错的话,在属性选项卡中)
  3. 使用动态查找如果记录尚未插入,则只会将记录插入到缓存中。
  4. 在表达式转换中使用变量端口,通过使用过滤器,即使是关系表或平面文件,我们也可以删除重复记录。由于动态查找的成本较高,因此这种方式更可取。

There are quite a few ways to handle this:

  1. Load the data to a temp table and then just select the distinct records
  2. Use a sorter or aggregator transformation and then select the distinct option (In the properties tab if I remember correctly)
  3. Use the dynamic lookup which will only insert records into the cache if they have not been inserted already.
  4. Use variable port in expression transformation and by using filter we can delete the duplicate records even if it is relational table or flat files.since dynamic lookup is costly, this way is preferable.
讽刺将军 2025-01-05 14:14:08

您始终可以使用聚合器转换并按您想要保持不同的所有数据进行分组。因此,如果您按所有列进行分组,那么最终只会出现那些不同的列。

You can always use an Aggregator transform and group by all the data you want to keep it distinct for. So if you group by all the columns only those who are distinct will come in the end.

套路撩心 2025-01-05 14:14:08

您可以使用排序器并检查加载不同的行。

You can use sorter and check load distinct rows.

浅笑轻吟梦一曲 2025-01-05 14:14:08

SRC-->SQ-->SRT-->EXP-->RTR-->TGT

您来自源的 inout 是

Col1 Col2
1 A
1 B
2 C
2 D
1 E
1 F
3 G
4 H
5 I
6 J
4 K
3 L

在排序器中按 col1 排序数据,在排序器数据之后看起来像这样

Col1 Col2
1 A
1 B
1 E
1 F
2 C
2 D
3 G
3 L
4 K
4 H
5 I
6 J

在 exp 中您有两个输入ports

in_col1
in_col2

按如下顺序创建变量端口和输出端口

v_FLAG= IIF(v_col1=in_col1,2,1)

v_col1=in_col1

out_FLAG=v_FLAG

然后表达式数据的输出如下所示

Col1 Col2 FLAG
1,A, 1
1, B, 2
1, E, 2
1, F, 2
2, C, 1
2, D, 2
3, G, 1
3, L, 2
4, K,1
4, H, 2
5, I, 1
6, J, 1

在路由器中创建两组,一组用于唯一记录,另一组用于重复记录。

unique=(FLAG=1)

duplicate=(FLAG=2)

将两个组连接到两个目标。SRC-->SQ-->SRT-->EXP-->RTR-->TGT

您来自源的 inout 是

Col1 Col2
1 A
1 B
2 C
2 D
1 E
1 F
3 G
4 H
5 I
6 J
4 K
3 L

在排序器中按 col1 排序数据,排序器数据看起来像 在 exp 中,

Col1 Col2
1 A
1 B
1 E
1 F
2 C
2 D
3 G
3 L
4 K
4 H
5 I
6 J

您有两个输入端口,

in_col1
in_col2

按如下顺序创建变量端口和输出端口

v_FLAG= IIF(v_col1=in_col1,2,1)

v_col1=in_col1

out_FLAG=v_FLAG

然后表达式数据的输出如下所示

Col1 Col2 FLAG
1,A, 1
1, B, 2
1, E, 2
1, F, 2
2, C, 1
2, D, 2
3, G, 1
3, L, 2
4, K,1
4, H, 2
5, I, 1
6, J, 1

在路由器中,创建两组,一组用于唯一记录,另一组用于重复记录。

unique=(FLAG=1)

duplicate=(FLAG=2)

将两个组连接到两个目标。

SRC-->SQ-->SRT-->EXP-->RTR-->TGT

You inout from source is

Col1 Col2
1 A
1 B
2 C
2 D
1 E
1 F
3 G
4 H
5 I
6 J
4 K
3 L

In sorter sort data by col1 and after sorter data looks like this

Col1 Col2
1 A
1 B
1 E
1 F
2 C
2 D
3 G
3 L
4 K
4 H
5 I
6 J

In exp you have two input ports

in_col1
in_col2

create variable ports and output ports in the order like below

v_FLAG= IIF(v_col1=in_col1,2,1)

v_col1=in_col1

out_FLAG=v_FLAG

Then out put of expression data looks like this

Col1 Col2 FLAG
1,A, 1
1, B, 2
1, E, 2
1, F, 2
2, C, 1
2, D, 2
3, G, 1
3, L, 2
4, K,1
4, H, 2
5, I, 1
6, J, 1

In router create two groups one for unique records and another one for duplicate records.

unique=(FLAG=1)

duplicate=(FLAG=2)

connect two groups to two targets.SRC-->SQ-->SRT-->EXP-->RTR-->TGT

You inout from source is

Col1 Col2
1 A
1 B
2 C
2 D
1 E
1 F
3 G
4 H
5 I
6 J
4 K
3 L

In sorter sort data by col1 and after sorter data looks like this

Col1 Col2
1 A
1 B
1 E
1 F
2 C
2 D
3 G
3 L
4 K
4 H
5 I
6 J

In exp you have two input ports

in_col1
in_col2

create variable ports and output ports in the order like below

v_FLAG= IIF(v_col1=in_col1,2,1)

v_col1=in_col1

out_FLAG=v_FLAG

Then out put of expression data looks like this

Col1 Col2 FLAG
1,A, 1
1, B, 2
1, E, 2
1, F, 2
2, C, 1
2, D, 2
3, G, 1
3, L, 2
4, K,1
4, H, 2
5, I, 1
6, J, 1

In router create two groups one for unique records and another one for duplicate records.

unique=(FLAG=1)

duplicate=(FLAG=2)

connect two groups to two targets.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文