avatarTech Zero

Summary

Global parameters in Azure Data Factory (ADF) are essential for preventing hardcoded values, enabling reusability across pipelines, and facilitating easy updates and environment-specific configurations.

Abstract

The use of global parameters in Azure Data Factory is a strategic approach for data teams to avoid hardcoding values such as table names and storage paths. These parameters can be defined once and utilized across multiple pipelines, activities, or datasets, which promotes reusability and simplifies maintenance. For instance, when loading data into multiple tables in an Azure SQL Database, global parameters can dynamically configure table names, allowing the same pipeline to be used for different tables. Similarly, for data processing from various folders in Azure Data Lake Storage Gen2, global parameters can manage storage paths, making it easier to switch between development and production environments. The benefits of using global parameters include reduced duplication of effort, centralized management, enhanced security, and the ability to quickly adapt to changes.

Opinions

  • The author emphasizes the importance of global parameters for maintaining consistency and reducing the time required for updates in ADF solutions.
  • Data engineering teams are encouraged to use global parameters to prevent hardcoding and to provide a centralized location for value updates.
  • Global parameters are seen as a means to ensure isolation of development and production environments, which can be crucial for access control and security.
  • The article suggests that leveraging global parameters can lead to more efficient and adaptable data integration workflows.
  • The author recommends trying out an AI service that offers similar capabilities to ChatGPT Plus (GPT-4) but at a more cost-effective rate, indicating a preference for this service based on its value proposition.

ADF-What are Global Parameters & How to Use Them?

Create global parameters in ADF to prevent hard coding values in your pipeline.

The data teams I have worked with so far have one thing in common — use of reusable values in Azure Data Factory. ADF calls them global parameters.

Simply put, global parameters can be used across multiple pipelines, activities or datasets without having the need to redefine those values over and over again.

Navigate to the manage section of any ADF of your choice and click global parameters.

If you don’t see any values here, let’s start to understand why you should look at creating global parameters and what purpose do they serve.

Example 1

Imagine you have an ADF solution that involves loading data into multiple tables in an Azure SQL Database. The 2 tables are customers and orders tables. We can create 2 global parameters like below-

We can now use these parameters in our ADF solution as shown below-

So, what’s the benefit in the above scenario?

Well there are several benefits-

  1. By using global parameters to define table names, you can reuse the same pipeline for loading data into different tables. Instead of creating separate pipelines for each table, you can dynamically configure the table names based on the global parameters.
  2. By parameterizing table names, we prevent the need to hardcode the table names at various locations in our pipelines. This obviously reduces the time to update table names should there be a need in the future. Instead of locating the table name in different pipelines and updating them one-by-one, global parameters provide a centralized location to do those updates once.
  3. Another benefit is that the global parameters can now be used by other data engineers on the team without them needing to hardcode values in their pipelines.

Example 2

Imagine you have an ADF solution that involves processing data files from different folders in an Azure Data Lake Storage Gen2 account. You can use global parameters to define and maintain those storage paths.

From a personal experience, data engineering teams like to split their ADLSG2 into 2 containers- development and production. This means a dataset’s location on ADLSG2 looks like below-

In development environment 

development/project1/2024-01-13/dataset.json
development/project2/2024-01-13/dataset.csv

In production environment 

production/project1/2024-01-13/dataset.json
production/project2/2024-01-13/dataset.csv

The above serves as an excellent use case to create 2 global parameters for our containers — development and production.

Let’s assume that there are a couple of csv datasets in a dev container but at different folder locations that look like this-

First dataset
development/mypath/dataset1.csv

Second dataset
development/anotherpath/dataset2.csv

The copy actions in ADF now look like below with the use of global parameters.

For dataset1.csv

For dataset2.csv

Notice that in both of the above snapshots, the main container has been parameterized and reused while still providing a data engineer the flexibility to customize the folder path.

What’s the benefit in this scenario?

  1. By creating the global environment parameters, you can define environment-specific configurations for your ADF solution. This allows your team to easily switch between the development and production environments by simply reusing one of the global parameters.
  2. Global parameters prevent hardcoding environment names in multiple places within your ADF solution. It makes it easier to update the environment in a single place as opposed to updating it in multiple places.
  3. Due to 2 separate global parameters, you can ensure isolation of your environments and if needed, apply access control to the production environment.

Summary

In the context of ADF, global parameters play a crucial role in streamlining the development and management of data integration workflows. As we noticed above, global parameters can provide a data engineering team the benefit of reusability, centralizing management and enhancing security in their data integration workflows. By leveraging global parameters, developers can ensure consistency, reduce duplication of effort, and easily adapt their workflows to changing requirements or different environments.

Adf Global Parameters
Azure Reusable Variables
Adf Reuse Parameters
Adf Create Global Value
Azure Data Factory
Recommended from ReadMedium
avatarAttraversiamo.srr
Azure Data Factory (ADF)

Introduction

3 min read