Mitchellsql

Skip to content
  • Home
  • About
Search

If Condition

Azure Data Factory – Lookup Activity

June 25, 2018 / Mitchell Pearson / 9 Comments

In the next few posts of my Azure Data Factory series I want to focus on a couple of new activities. Specifically the Lookup, If Condition, and Copy activities. The copy activity in this pipeline will only be executed if the modified date of a file is greater than the last execution date. In other words, the copy activity only runs if new data has been loaded into the file located on Azure Blob Storage. The following diagram provides a visualization of the final design pattern.

  • Check out part one here: Azure Data Factory – Get Metadata Activity
  • Check out part two here: Azure Data Factory – Stored Procedure Activity

image

Setting up the Lookup Activity in Azure Data Factory v2

If you come from an SQL background this next step might be slightly confusing to you, as it was for me. For this demo we are using the lookup activity to execute a stored procedure instead of using the stored procedure activity. The reason we are not using the stored procedure activity is because it currently does not produce any output parameters and therefore the output of a stored procedure can not be used in the pipeline. Maybe this is something that Microsoft will add as functionality in the future, but for now the lookup activity will get the job done!

  1. First, I am going to drag the Lookup activity into the pipeline along with the Get Metadata activity from the previous blog posts.
  2. In the properties window I changed the name of the task to “Get Last Load Date” to make it more descriptive.

1_Add_Lookup_Activity

  1. After the name has been assigned from the previous step, select the Settings tab.
  2. Choose a “Source Dataset”. A dataset must be selected even though we are not returning the results from the selected dataset. We are going to return results from a stored procedure. I have chosen a dataset that links to my Azure SQL DB where my control table and stored procedure current exist.
  3. Finally, click the radial button for Stored Procedure and then choose your stored procedure from the drop down list.

2_Settings_Configuration

The stored procedure referenced in the previous step is a very simple stored procedure that is returning the last ExecutionDate from my Control Table. Keep in mind that this code would typically be a little more robust as this control table would have many rows for many different sources. For this blog I have kept the code simple to demo the functionality of the lookup task. Take a look at the stored procedure code below:

3_StoredProcedure

Now that the lookup component has been configured it’s time to debug the pipeline and validate the output results of our activities.

4_Debug_Test

After a successful run you can validate the output parameters by clicking on the buttons highlighted in the below image, this was explained in more detail back in the first post of this blog series.

5_Output_Results

In the next blog in this series I will outline how to use the output parameters from these activities using the If Condition activity. Thanks for reading my blog!

Recent Posts

  • Working with Averages in DAX using AVERAGEX, SUMMARIZE and DATESINPERIOD
  • Managed Virtual Networks and Private Endpoints in Azure Synapse and Azure Data Factory
  • Dynamically changing title names in Power BI
  • Working with Parameters and Expressions in Azure Data Factory
  • Introduction to Wrangling Data Flows in Azure Data Factory

Recent Comments

Unknown's avatarCheck it Out !!… on Dynamically changing title nam…
fadwamousa's avatarfadwamousa on Dynamically changing title nam…
weekly fanz's avatarweekly fanz on ALL vs ALLSELECTED in DAX and…
VINICIUS AUGUSTUS PALUCH's avatarVINICIUS AUGUSTUS PA… on Azure Data Factory–Filte…
Mitchell Pearson's avatarMitchell Pearson on Advanced TSQL Takeover

Archives

  • January 2021
  • December 2020
  • September 2020
  • May 2020
  • April 2020
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018
  • August 2017
  • July 2017
  • June 2017
  • April 2017
  • August 2016
  • May 2016
  • April 2016
  • February 2016
  • July 2015
  • June 2015
  • April 2015
  • February 2015
  • January 2015
  • November 2014
  • September 2014
  • August 2014
  • June 2014
  • May 2014
  • February 2014
  • January 2014

Categories

  • Azure Data Factory
  • Azure Logic Apps
  • BIxPress
  • DAX
  • DBA
  • MDX
  • Performance Tuning
  • Power BI
  • PowerApps
  • Problem, Design, Solution
  • Professional / Organization
  • Scripting
  • Speaking
  • SQL Tips
  • SSAS – Analysis Services
  • SSIS
  • T-SQL
  • Task Factory
  • Tips and Tricks
  • Working with R

Meta

  • Create account
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.com

Top Posts & Pages

  • The transaction log for database is full due to ‘REPLICATION’. “Replication not enabled.” CDC
  • Quick Tips - Connecting to a SharePoint Folder in Power BI
  • How to add Data Labels to maps in Power BI
  • Move Files in SSIS Using execute process task
  • SQL Tips! Set your default database in SSMS (Installment 1)
Blog at WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Subscribe Subscribed
    • Mitchellsql
    • Join 101 other subscribers
    • Already have a WordPress.com account? Log in now.
    • Mitchellsql
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar