根据标志值运行管道 [英] Run Pipeline based on Flag Value

查看:70
本文介绍了根据标志值运行管道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有必要根据标志值在何处运行管道.

我有一张存储标志值的表,如果对于任何特定的记录标志值是1,则管道应该运行,否则就不应该运行.

请帮助我解决问题

感谢您的时间:)


Pankaj

解决方案

嗨Pankaj,

您可以使用查阅活动查询表中存储的标志值,然后使用 IF活动,以检查其值是否为1,最后参考 执行管道活动到IF-TRUE活动,执行管道活动将调用您要运行的管道,请参见以下示例:

 {
    名称":"pipeline28",
    属性":{
        活动":[
            {
                名称":"Lookup1",
                "type":"Lookup",
                政策":{
                    " timeout":"7.00:00:00",
                    重试":0,
                    "retryIntervalInSeconds":30,
                    "secureOutput":false,
                    "secureInput":false
                },
                "typeProperties":{
                    来源":{
                        " type" ;:" SqlSource"
                    },
                    数据集":{
                        " referenceName":" AzureSqlTable1" ;,//此表存储标志值
                        "type":"DatasetReference";
                    }
                }
            },
            {
                名称":"If Condition1",
                "type":"IfCondition",
                "dependsOn":[
                    {
                        "activity":"Lookup1",
                        "dependencyConditions":[
                            成功";成功".
                        ]
                    }
                ],
                "typeProperties":{
                    表达式":{
                        "value":"@ equals(activity('Lookup1').output.firstRow.flag,'1')'",//这是要检查标志值是否为"1"
                        类型":表达";
                    },
                    "ifTrueActivities":[
                        {
                            名称":"Execute Pipeline1",
                            "type":"ExecutePipeline",
                            "typeProperties":{
                                管道":{
                                    " referenceName":" pipeline1" ;,//如果检查为true,则要运行的管道.
                                    类型":"PipelineReference"
                                }
                            }
                        }
                    ]
                }
            }
        ]
    }
} 

一些有用的链接:

https://docs.microsoft.com/en-us/azure/data-factory/control-flow-if-condition-activity

解决方案

Hi Pankaj,

You could use a Lookup activity to query the flag value stored in the table, then use an IF activity to check whether its value is 1, finally refer an Execute pipeline activity to IF-TRUE activity, the Execute pipeline activity will invoke the piepeline you want to run, see the below example:

{
    "name": "pipeline28",
    "properties": {
        "activities": [
            {
                "name": "Lookup1",
                "type": "Lookup",
                "policy": {
                    "timeout": "7.00:00:00",
                    "retry": 0,
                    "retryIntervalInSeconds": 30,
                    "secureOutput": false,
                    "secureInput": false
                },
                "typeProperties": {
                    "source": {
                        "type": "SqlSource"
                    },
                    "dataset": {
                        "referenceName": "AzureSqlTable1", // this table stores the flag value
                        "type": "DatasetReference"
                    }
                }
            },
            {
                "name": "If Condition1",
                "type": "IfCondition",
                "dependsOn": [
                    {
                        "activity": "Lookup1",
                        "dependencyConditions": [
                            "Succeeded"
                        ]
                    }
                ],
                "typeProperties": {
                    "expression": {
                        "value": "@equals(activity('Lookup1').output.firstRow.flag,'1')", // this is to check wether the flag value is '1'
                        "type": "Expression"
                    },
                    "ifTrueActivities": [
                        {
                            "name": "Execute Pipeline1",
                            "type": "ExecutePipeline",
                            "typeProperties": {
                                "pipeline": {
                                    "referenceName": "pipeline1", // if check is true, the pipeline you want to run.
                                    "type": "PipelineReference"
                                }
                            }
                        }
                    ]
                }
            }
        ]
    }
}

Some useful link: 

https://docs.microsoft.com/en-us/azure/data-factory/control-flow-lookup-activity

https://docs.microsoft.com/en-us/azure/data-factory/control-flow-if-condition-activity

https://docs.microsoft.com/en-us/azure/data-factory/control-flow-execute-pipeline-activity


这篇关于根据标志值运行管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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