0
votes

I'm currently struggling with the Azure Data Factory v2 If activity which always fails with this error message: enter image description here

I've designed two separate pipelines, one takes the full snapshot of the data (1333 records) from the on-premises SQL Server and loads the data into the Azure SQL Database, and another one just takes delta from the same source.

Both pipelines work fine when executed independently.

I then decided to wrap these two pipelines into the one parent pipeline which would do this: 1. Execute LookUp activity to check if the target table in Azure SQL Database has any records, basic Select Count(Request_ID) As record_count From target_table - activity works fine, I can preview the returned record count.

2. Pass the output from the LookUp activity to the If activity with the conditions that if record_count = 0, the parent pipeline would invoke the full load pipeline, otherwise the parent pipeline would invoke the delta load pipeline.

This is the actual expression:
{@activity('lookup_sites_record_count').output.firstRow.record_count}==0"

Whenever I try to execute this parent pipeline, it fails with the above message of "Activity failed: Activity failed because an inner activity failed."

Both inner activities, that is, full load and delta load pipelines, work just fine when triggered independently.

What I'm missing?

Many thanks in advance :).

mikhailg

Pipeline's JSON definition below:

{
"name": "pl_remedyreports_load_rs_sites",
"properties": {
    "activities": [
        {
            "name": "lookup_sites_record_count",
            "type": "Lookup",
            "policy": {
                "timeout": "7.00:00:00",
                "retry": 0,
                "retryIntervalInSeconds": 30,
                "secureOutput": false
            },
            "typeProperties": {
                "source": {
                    "type": "SqlSource",
                    "sqlReaderQuery": "Select Count(Request_ID) As record_count From mdp.RS_Sites;"
                },
                "dataset": {
                    "referenceName": "ds_azure_sql_db_sites",
                    "type": "DatasetReference"
                }
            }
        },
        {
            "name": "If_check_site_record_count",
            "type": "IfCondition",
            "dependsOn": [
                {
                    "activity": "lookup_sites_record_count",
                    "dependencyConditions": [
                        "Succeeded"
                    ]
                }
            ],
            "typeProperties": {
                "expression": {
                    "value": "{@activity('lookup_sites_record_count').output.firstRow.record_count}==0",
                    "type": "Expression"
                },
                "ifFalseActivities": [
                    {
                        "name": "pl_remedyreports_invoke_load_sites_inc",
                        "type": "ExecutePipeline",
                        "typeProperties": {
                            "pipeline": {
                                "referenceName": "pl_remedyreports_load_sites_inc",
                                "type": "PipelineReference"
                            }
                        }
                    }
                ],
                "ifTrueActivities": [
                    {
                        "name": "pl_remedyreports_invoke_load_sites_full",
                        "type": "ExecutePipeline",
                        "typeProperties": {
                            "pipeline": {
                                "referenceName": "pl_remedyreports_load_sites_full",
                                "type": "PipelineReference"
                            }
                        }
                    }
                ]
            }
        }
    ],
    "folder": {
        "name": "Load Remedy Reference Data"
    }
}

}

1

1 Answers

1
votes

Your expression should be:

@equals(activity('lookup_sites_record_count').output.firstRow.record_count,0)