从DB2数据库的两个表中提取数据并加载到临时表中

发布于 2025-01-07 04:29:11 字数 492 浏览 1 评论 0原文

我正在创建一个 informatica 工作流程,它可以从 DB2 数据库的两个表中提取数据并加载到临时表中。假设两个源表名称是帐户(父)和活动(子)。他们有1:M的关系。意味着一个帐户可以有多个活动(Account.PK =Activities.FK)。活动表有两列 - 第一列“Type”,其值可以是“Paid”、“Will-Pay”或“Not-Paid”。第二列是“Created_Date”日期时间数据类型,每当您创建新活动记录、日期和时间时会在这个领域得到印记。现在,在临时表中加载数据的条件是 - “对于帐户记录,它将首先在活动表中检查今天的付费活动(类型=付费)。如果它发现多个付费活动,那么它将选择最新创建的其中一个(Created_Date 列)。如果该帐户没有付费活动记录,则它将选择最新创建的“Will-Pay”活动。”意味着,它应该为帐户选择今天(Sysdate)的最新付费活动,如果它不存在,那么它只会选择今天最新的意愿付款活动。请帮助我了解如何在 Informatica 工作流程中实现此逻辑以及我应该使用哪些转换以及如何使用?多谢。请帮忙。

I am creating an informatica workflow which can extract data from two tables of DB2 database and load into a temporary table. Suppose the two source tables name are Account (Parent) and Activities (Child). They have 1:M relationship. Means an Account can have many Activities (Account.PK = Activities.FK). Activities table has two columns- first 'Type' whose value could be 'Paid', 'Will-Pay' or 'Not-Paid'.And second column is 'Created_Date' datetime datatype, whenever you create new activity record, date and time would get stamp in this field. Now, condition to load data in temporary table is - "For an Account record, it would 1st check in Activities table for today's Paid activities (Type = Paid). If it finds more than one paid activities, then it would pick the Latest created one (Created_Date column) out of them. If there is no Paid activity record for the Account, then it would pick latest created 'Will-Pay' activity." Means, it should pick latest Paid activity for today (Sysdate) for an Account, if it is not present then only It will pick latest Will-pay activity for today. Please help me to understand how I can implement this logic in Informatica workflow and which transformations I should use and how? Thanks alot. Kindly help.

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

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

发布评论

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

评论(1

゛清羽墨安 2025-01-14 04:29:11

在 SQL 上执行此操作的最佳方法是因为在 ETL 上实现业务逻辑并不好。但如果你坚持的话,可以通过多种方式来创建它。例如:

使用 SQL 覆盖
您可以使用覆盖的 SQL(以及列)为“活动”表创建 3 个查找转换,并为条件创建 1 个表达式转换。

  1. 查找多个“付费”活动帐户
  2. 查找每个帐户最后一个“付费”活动
  3. 查找每个帐户最后一个“将支付”活动
  4. 表达式根据 1-3 个查找结果返回正确的活动键

无需 SQL 覆盖即可通过过滤器、聚合器、连接器转换重新创建类似的逻辑。

Best way to do it on SQL cause realize business logic on ETL it's not good. But if you insist it can be created by many ways. As example:

With SQL override
You can create 3 lookup transformation for Activities table with overrided SQL (and columns too) and one expression transformation for condition.

  1. Lookup to find more than one 'paid' activities accounts
  2. Lookup to find last 'paid' activity per account
  3. Lookup to find last 'will pay' activity per account
  4. Expression to return correct Activities key based from 1-3 lookup results

Without SQL override you need to recreate similar logic with filter, aggregator, joiner transformations.

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