繁体   English   中英

Azure 数据工厂接收器目标筛选器

[英]Azure Data Factory Sink Destination Filter

如何使用 Azure 数据工厂在目标表的更新接收器操作中添加过滤器。

基本上我正在尝试实现以下查询,并且我需要目标接收器中的过滤器 end_date = '9999-12-31 。

update testdb.test_scd2
set end_date = SourceStream.end_date
where cust_id = SourceStream.cust_id
and end_date = '9999-12-31

' ADF 脚本 - 根据 Mark 的评论更新。 但它正在更新目标表中的所有数据。 只需要用 end_date - '9999-12-31' 更新一行

source(output(
        cust_id as string,
        end_date_new as date
    ),
    allowSchemaDrift: true,
    validateSchema: false,
    ignoreNoFilesFound: false,
    wildcardPaths:['walgreen/source/test_upd.dat']) ~> FFWCustomerUpd
source(output(
        cust_id as string,
        eff_date as date,
        end_date as date,
        first_name as string,
        last_name as string,
        status as string
    ),
    allowSchemaDrift: true,
    validateSchema: false,
    ignoreNoFilesFound: false,
    isolationLevel: 'READ_UNCOMMITTED',
    format: 'table') ~> source1
Exists1 alterRow(updateIf(1==1)) ~> AlterTeradataConnectorupd
source1 filter(end_date==toDate('9999-12-31')) ~> Filter1
FFWCustomerUpd, Filter1 exists(FFWCustomerUpd@cust_id == source1@cust_id,
    negate:false,
    broadcast: 'auto')~> Exists1
AlterTeradataConnectorupd sink(input(
        cust_id as string,
        eff_date as date,
        end_date as date,
        first_name as string,
        last_name as string,
        status as string
    ),
    allowSchemaDrift: true,
    validateSchema: false,
    deletable:false,
    insertable:false,
    updateable:true,
    upsertable:false,
    keys:['cust_id'],
    format: 'table',
    mapColumn(
        cust_id,
        end_date = end_date_new
    ),
    skipDuplicateMapInputs: true,
    skipDuplicateMapOutputs: true) ~> TeradataConnectorupd

数据流

更新后的目的地表

在您的 Alter Row 中为“Update If”设置策略:end_date == 9999-12-31

在接收器中,将您的键列设置为 cust_id

这是逻辑流程的伪代码大纲:

  1. 新传入的源+目标表作为源
  2. 在底部流中,仅过滤您需要替换的日期
  3. 仅过滤顶部流中具有该日期的 ID
  4. 将 Alter Row 设置为 true() 以进行更新,以便更新所有行。 在这一点上,我们有信心他们都是 9999-12-31
  5. 仅设置“允许更新”时写入接收器

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM