【问题标题】:How to create a automatic process to update record when one field is changed如何在更改一个字段时创建自动更新记录的过程
【发布时间】:2016-07-07 19:06:12
【问题描述】:

一段时间以来,我一直在努力解决这个问题,并且需要您的帮助来解决这个问题。我在 informatica 中创建了一个 ETL 进程,该进程从 sql server(源数据库)获取用户并将它们添加到 mysql(目标数据库)中 该过程涉及多个步骤。

步骤 1. - 将 source.dbo.[user] (SQL SERVER) 移动到目标。user 用户表看起来像这样

userid   username  profile  disabled
1        A         A         0
2        B         A         0
3        c         B         1

当禁用状态更改和添加新记录时,此表会被更新

第 2 步 - 然后将新用户插入到 target.worker 表中; 为了只添加工作表中不存在的用户,使用左连接:

select wrk.*, usr.* from target.worker 
wrk left join target.user usr on wrk.userid=usr.userid 
where wrk.usrid is null;

worker 表看起来像这样

id   username   userid   disabled
1    A          1        0
2    B          A        0

那么在进程运行后,userid 3 将被添加到工作表中

现在我想不通的部分来了: 当他们的禁用状态也发生变化时,我需要更新工作表中的用户。 目前,我已将设置映射为从左连接用户添加工作人员,以仅添加当前工作人员表中不存在的用户。 但是,当相应用户表中的禁用状态发生变化时,我如何映射它以便更新工作表中的那些记录

我希望这是有道理的。 为了更简单:

当 target.[user] 是

userid   username  profile  disabled
1        A         A         0
2        B         A         0
3        c         B         1
4        D         C         0

而target.worker是

userid   username  profile  disabled
1        A         A         0
2        B         A         0
3        c         B         0

我需要一个带有过滤器或解释过程的连接查询,以便工作表插入新记录并更改现有记录的禁用状态:所以它看起来像这样

 userid   username  profile  disabled
    1        A         A         0
    2        B         A         0
    3        c         B         1 <--- Record updated
    4        D         C         0 <-- New record added

【问题讨论】:

  • 那么困难是什么?

标签: mysql sql-server-2012 etl informatica


【解决方案1】:

在 target.worker 上使用 Lookup 来验证记录是否已经存在。如果它确实 NewLookupRow 将为 2(更新),请在更新转换中使用 DD_UPDATE。如果为 1,则使用 DD_INSERT。在 Update Trans 之前使用 NewLookupRow != 0 过滤器来跳过目标中已有的行。

【讨论】:

  • 谢谢,我不知道如何在 informatica 云中使用查找工具。但相反,我在连接表上为更新记录创建了另一个过滤器
  • 哦 - 您没有指出它与 Informatica Cloud 有关。细木工也是要走的路。
猜你喜欢
  • 2022-10-23
  • 2017-08-18
  • 1970-01-01
  • 1970-01-01
  • 2016-01-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多