2.5.3. Parameters and Dynamic Expressions
💡 First Principle: Parameters and expressions make pipelines flexible and reusable—like variables in programming. Instead of creating separate pipelines for each region (copy-paste nightmare), a single parameterized pipeline handles all regions. The parameter says "which region?" and the pipeline adapts.
Scenario: A pipeline processes sales data for different regions. Instead of creating separate pipelines for each region, use a parameter to specify the region at runtime.
Pipeline Parameters
- Definition: Variables defined at pipeline level
- Usage: Referenced in activities using
@pipeline().parameters.ParameterName - Benefit: Single pipeline serves multiple scenarios
Dynamic Expressions
- Syntax:
@{expression}for string interpolation - Functions:
concat(),utcnow(),formatDateTime(), etc. - Example: Dynamic file path based on date
// Dynamic file path expression
@concat('sales/', formatDateTime(utcnow(), 'yyyy/MM/dd'), '/data.parquet')
// Result: sales/2026/01/02/data.parquet
Visual: Parameterized Pipeline
⚠️ Exam Trap: Creating separate pipelines for each dataset variation is a maintenance nightmare. Use parameters and expressions to create flexible, reusable pipelines. Questions asking for the "most efficient" approach are often testing parameterization knowledge.
Key Trade-Offs:
- Parameterization vs. Simplicity: Heavily parameterized pipelines are flexible but harder to understand and debug
- Dynamic vs. Static Paths: Dynamic paths enable automation but can fail silently if expressions produce unexpected results
Reflection Question: Your pipeline needs to process data from folders named by date (e.g., /2026/01/02/). How would you use expressions to construct the folder path dynamically?