How to avoid running transformations in the Mapping Data between based on conditions in ADF.

Vaibhav 105 Reputation points
2024-04-04T13:55:23.29+00:00

I have a below data flow.
User's image

Now, I want to design a logic so that my alterRow1 and sink4 will only execute if certain conditions are met and similarly sink2 should run if certain conditions are met.

Currently, I can see that even though conditional criteria is not satisfied, still the transformations run.

User's image

My conditional :

User's image

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,835 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Richard Swinbank 522 Reputation points MVP
    2024-04-07T16:54:10.3833333+00:00

    I think the issue here is that you're thinking about data flow transformations in the same way that you think about controlling a flow of execution — but they're different.

    When controlling execution flow (for example in an ADF pipeline) you can use conditions to determine which activities run and which do not. Not every activity in an ADF pipeline has to run for the pipeline's execution to complete.

    This isn't the same in a data flow. Conceptually, you can visualise rows as "flowing" through every one of a data flow's transformations. Instead of controlling which transformations are executed, you control which rows flow through each one. If your conditional split diverts every row to the same output, the other output has no effect — even though it appears to "run", no rows actually flow through it.

    0 comments No comments

  2. Pinaki Ghatak 4,610 Reputation points Microsoft Employee
    2024-05-10T19:53:53+00:00

    Hello @Vaibhav

    Based on the screenshot you provided, it seems like you want to execute certain transformations and sinks based on certain conditions.

    To achieve this, you can use the conditional split transformation in your data flow. Here are the steps to add a conditional split transformation:

    1. Click on the plus sign (+) next to your source transformation to add a new transformation.
    2. Search for "Conditional Split" and select it.
    3. Connect the output of your source transformation to the input of the conditional split transformation.
    4. Click on the conditional split transformation to open its settings.
    5. In the "Add condition" section, add your condition by selecting the appropriate column and operator and entering the value you want to compare it to.
    6. In the "Add output" section, add the name of the output and select the transformations and sink you want to execute if the condition is met.
    7. Repeat steps 5 and 6 for each condition you want to add. Once you have added all your conditions and outputs, connect the outputs of the conditional split transformation to the appropriate sinks. In your case, you can add a condition to check if the value in the "status" column is equal to "approved" and add the transformations and sink you want to execute if the condition is met. Similarly, you can add another condition to check if the value in the "status" column is equal to "rejected" and add the transformations and sink you want to execute if the condition is met.

    I hope this helps! Let me know if you have any further questions.


    I hope that this response has addressed your query and helped you overcome your challenges. If so, please mark this response as Answered. This will not only acknowledge our efforts, but also assist other community members who may be looking for similar solutions.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.