Skip to content

Commit e54f169

Browse files
authored
Merge pull request #259585 from jonburchel/2023-11-27-merge-public-prs
2023 11 27 merge public prs
2 parents 940daa3 + 3f2ee42 commit e54f169

File tree

3 files changed

+125
-115
lines changed

3 files changed

+125
-115
lines changed
33.9 KB
Loading
Lines changed: 124 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,124 @@
1-
---
2-
title: Parameterizing mapping data flows
3-
titleSuffix: Azure Data Factory & Azure Synapse
4-
description: Learn how to parameterize a mapping data flow from Azure Data Factory and Azure Synapse Analytics pipelines
5-
author: kromerm
6-
ms.author: makromer
7-
ms.reviewer: daperlov
8-
ms.service: data-factory
9-
ms.subservice: data-flows
10-
ms.custom: synapse
11-
ms.topic: conceptual
12-
ms.date: 07/20/2023
13-
---
14-
15-
# Parameterizing mapping data flows
16-
17-
[!INCLUDE[appliesto-adf-asa-md](includes/appliesto-adf-asa-md.md)]
18-
19-
Mapping data flows in Azure Data Factory and Synapse pipelines support the use of parameters. Define parameters inside of your data flow definition and use them throughout your expressions. The parameter values are set by the calling pipeline via the Execute Data Flow activity. You have three options for setting the values in the data flow activity expressions:
20-
21-
* Use the pipeline control flow expression language to set a dynamic value
22-
* Use the data flow expression language to set a dynamic value
23-
* Use either expression language to set a static literal value
24-
25-
Use this capability to make your data flows general-purpose, flexible, and reusable. You can parameterize data flow settings and expressions with these parameters.
26-
27-
## Create parameters in a mapping data flow
28-
29-
To add parameters to your data flow, click on the blank portion of the data flow canvas to see the general properties. In the settings pane, you will see a tab called **Parameter**. Select **New** to generate a new parameter. For each parameter, you must assign a name, select a type, and optionally set a default value.
30-
31-
:::image type="content" source="media/data-flow/create-params.png" alt-text="Create Data Flow parameters":::
32-
33-
## Use parameters in a mapping data flow
34-
35-
Parameters can be referenced in any data flow expression. Parameters begin with $ and are immutable. You will find the list of available parameters inside of the Expression Builder under the **Parameters** tab.
36-
37-
:::image type="content" source="media/data-flow/parameter-expression.png" alt-text="Screenshot shows the available parameters in the Parameters tab.":::
38-
39-
You can quickly add additional parameters by selecting **New parameter** and specifying the name and type.
40-
41-
:::image type="content" source="media/data-flow/new-parameter-expression.png" alt-text="Screenshot shows the parameters in the Parameters tab with new parameters added.":::
42-
43-
## Assign parameter values from a pipeline
44-
45-
Once you've created a data flow with parameters, you can execute it from a pipeline with the Execute Data Flow Activity. After you add the activity to your pipeline canvas, you will be presented with the available data flow parameters in the activity's **Parameters** tab.
46-
47-
When assigning parameter values, you can use either the [pipeline expression language](control-flow-expression-language-functions.md) or the [data flow expression language](data-transformation-functions.md) based on spark types. Each mapping data flow can have any combination of pipeline and data flow expression parameters.
48-
49-
:::image type="content" source="media/data-flow/parameter-assign.png" alt-text="Screenshot shows the Parameters tab with Data Flow expression selected for the value of myparam.":::
50-
51-
### Pipeline expression parameters
52-
53-
Pipeline expression parameters allow you to reference system variables, functions, pipeline parameters, and variables similar to other pipeline activities. When you click **Pipeline expression**, a side-nav will open allowing you to enter an expression using the expression builder.
54-
55-
:::image type="content" source="media/data-flow/parameter-pipeline.png" alt-text="Screenshot shows the expression builder pane.":::
56-
57-
When referenced, pipeline parameters are evaluated and then their value is used in the data flow expression language. The pipeline expression type doesn't need to match the data flow parameter type.
58-
59-
#### String literals vs expressions
60-
61-
When assigning a pipeline expression parameter of type string, by default quotes will be added and the value will be evaluated as a literal. To read the parameter value as a data flow expression, check the expression box next to the parameter.
62-
63-
:::image type="content" source="media/data-flow/string-parameter.png" alt-text="Screenshot shows the Data flow parameters pane Expression selected for a parameter.":::
64-
65-
If data flow parameter `stringParam` references a pipeline parameter with value `upper(column1)`.
66-
67-
- If expression is checked, `$stringParam` evaluates to the value of column1 all uppercase.
68-
- If expression is not checked (default behavior), `$stringParam` evaluates to `'upper(column1)'`
69-
70-
#### Passing in timestamps
71-
72-
In the pipeline expression language, System variables such as `pipeline().TriggerTime` and functions like `utcNow()` return timestamps as strings in format 'yyyy-MM-dd\'T\'HH:mm:ss.SSSSSSZ'. To convert these into data flow parameters of type timestamp, use string interpolation to include the desired timestamp in a `toTimestamp()` function. For example, to convert the pipeline trigger time into a data flow parameter, you can use `toTimestamp(left('@{pipeline().TriggerTime}', 23), 'yyyy-MM-dd\'T\'HH:mm:ss.SSS')`.
73-
74-
:::image type="content" source="media/data-flow/parameter-timestamp.png" alt-text="Screenshot shows the Parameters tab where you can enter a trigger time.":::
75-
76-
> [!NOTE]
77-
> Data Flows can only support up to 3 millisecond digits. The `left()` function is used trim off additional digits.
78-
79-
#### Pipeline parameter example
80-
81-
Say you have an integer parameter `intParam` that is referencing a pipeline parameter of type String, `@pipeline.parameters.pipelineParam`.
82-
83-
:::image type="content" source="media/data-flow/parameter-pipeline-2.png" alt-text="Screenshot shows the Parameters tab with parameters named stringParam and intParam.":::
84-
85-
`@pipeline.parameters.pipelineParam` is assigned a value of `abs(1)` at runtime.
86-
87-
:::image type="content" source="media/data-flow/parameter-pipeline-4.png" alt-text="Screenshot shows the Parameters tab with the value of a b s (1) selected.":::
88-
89-
When `$intParam` is referenced in an expression such as a derived column, it will evaluate `abs(1)` return `1`.
90-
91-
:::image type="content" source="media/data-flow/parameter-pipeline-3.png" alt-text="Screenshot shows the columns value.":::
92-
93-
### Data flow expression parameters
94-
95-
Select **Data flow expression** will open up the data flow expression builder. You will be able to reference functions, other parameters and any defined schema column throughout your data flow. This expression will be evaluated as is when referenced.
96-
97-
> [!NOTE]
98-
> If you pass in an invalid expression or reference a schema column that doesn't exist in that transformation, the parameter will evaluate to null.
99-
100-
101-
### Passing in a column name as a parameter
102-
103-
A common pattern is to pass in a column name as a parameter value. If the column is defined in the data flow schema, you can reference it directly as a string expression. If the column isn't defined in the schema, use the `byName()` function. Remember to cast the column to its appropriate type with a casting function such as `toString()`.
104-
105-
For example, if you wanted to map a string column based upon a parameter `columnName`, you can add a derived column transformation equal to `toString(byName($columnName))`.
106-
107-
:::image type="content" source="media/data-flow/parameterize-column-name.png" alt-text="Passing in a column name as a parameter":::
108-
109-
> [!NOTE]
110-
> In data flow expressions, string interpolation (substituting variables inside of the string) is not supported. Instead, concatenate the expression into string values. For example, `'string part 1' + $variable + 'string part 2'`
111-
112-
## Next steps
113-
* [Execute data flow activity](control-flow-execute-data-flow-activity.md)
114-
* [Control flow expressions](control-flow-expression-language-functions.md)
1+
---
2+
title: Parameterizing mapping data flows
3+
titleSuffix: Azure Data Factory & Azure Synapse
4+
description: Learn how to parameterize a mapping data flow from Azure Data Factory and Azure Synapse Analytics pipelines
5+
author: kromerm
6+
ms.author: makromer
7+
ms.reviewer: daperlov
8+
ms.service: data-factory
9+
ms.subservice: data-flows
10+
ms.custom: synapse
11+
ms.topic: conceptual
12+
ms.date: 11/15/2023
13+
---
14+
15+
# Parameterizing mapping data flows
16+
17+
[!INCLUDE[appliesto-adf-asa-md](includes/appliesto-adf-asa-md.md)]
18+
19+
Mapping data flows in Azure Data Factory and Synapse pipelines support the use of parameters. Define parameters inside of your data flow definition and use them throughout your expressions. The parameter values are set by the calling pipeline via the Execute Data Flow activity. You have three options for setting the values in the data flow activity expressions:
20+
21+
* Use the pipeline control flow expression language to set a dynamic value
22+
* Use the data flow expression language to set a dynamic value
23+
* Use either expression language to set a static literal value
24+
25+
Use this capability to make your data flows general-purpose, flexible, and reusable. You can parameterize data flow settings and expressions with these parameters.
26+
27+
## Create parameters in a mapping data flow
28+
29+
To add parameters to your data flow, click on the blank portion of the data flow canvas to see the general properties. In the settings pane, you'll see a tab called **Parameter**. Select **New** to generate a new parameter. For each parameter, you must assign a name, select a type, and optionally set a default value.
30+
31+
:::image type="content" source="media/data-flow/create-params.png" alt-text="Screenshot of create Data Flow parameters.":::
32+
33+
## Use parameters in a mapping data flow
34+
35+
Parameters can be referenced in any data flow expression. Parameters begin with $ and are immutable. you'll find the list of available parameters inside of the Expression Builder under the **Parameters** tab.
36+
37+
:::image type="content" source="media/data-flow/parameter-expression.png" alt-text="Screenshot shows the available parameters in the Parameters tab.":::
38+
39+
You can quickly add additional parameters by selecting **New parameter** and specifying the name and type.
40+
41+
:::image type="content" source="media/data-flow/new-parameter-expression.png" alt-text="Screenshot shows the parameters in the Parameters tab with new parameters added.":::
42+
43+
## Using parameterized linked services in a mapping data flow
44+
45+
Parameterized linked services can be used in a mapping data flow (for either dataset or inline source types).
46+
47+
For the inline source type, the linked service parameters are exposed in the data flow activity settings within the pipeline as shown below.
48+
49+
:::image type="content" source="media/data-flow/data-flow-params-1.png" alt-text="Screenshot shows the use of linked service parameters in the data flow.":::
50+
51+
For the dataset source type, the linked service parameters are exposed directly in the dataset configuration.
52+
53+
## Assign parameter values from a pipeline
54+
55+
Once you've created a data flow with parameters, you can execute it from a pipeline with the Execute Data Flow Activity. After you add the activity to your pipeline canvas, you'll be presented with the available data flow parameters in the activity's **Parameters** tab.
56+
57+
When assigning parameter values, you can use either the [pipeline expression language](control-flow-expression-language-functions.md) or the [data flow expression language](data-transformation-functions.md) based on spark types. Each mapping data flow can have any combination of pipeline and data flow expression parameters.
58+
59+
:::image type="content" source="media/data-flow/parameter-assign.png" alt-text="Screenshot shows the Parameters tab with Data Flow expression selected for the value of myparam.":::
60+
61+
### Pipeline expression parameters
62+
63+
Pipeline expression parameters allow you to reference system variables, functions, pipeline parameters, and variables similar to other pipeline activities. When you click **Pipeline expression**, a side-nav will open allowing you to enter an expression using the expression builder.
64+
65+
:::image type="content" source="media/data-flow/parameter-pipeline.png" alt-text="Screenshot shows the expression builder pane.":::
66+
67+
When referenced, pipeline parameters are evaluated and then their value is used in the data flow expression language. The pipeline expression type doesn't need to match the data flow parameter type.
68+
69+
#### String literals vs expressions
70+
71+
When assigning a pipeline expression parameter of type string, by default quotes will be added and the value will be evaluated as a literal. To read the parameter value as a data flow expression, check the expression box next to the parameter.
72+
73+
:::image type="content" source="media/data-flow/string-parameter.png" alt-text="Screenshot shows the Data flow parameters pane Expression selected for a parameter.":::
74+
75+
If data flow parameter `stringParam` references a pipeline parameter with value `upper(column1)`.
76+
77+
- If expression is checked, `$stringParam` evaluates to the value of column1 all uppercase.
78+
- If expression isn't checked (default behavior), `$stringParam` evaluates to `'upper(column1)'`
79+
80+
#### Passing in timestamps
81+
82+
In the pipeline expression language, System variables such as `pipeline().TriggerTime` and functions like `utcNow()` return timestamps as strings in format 'yyyy-MM-dd\'T\'HH:mm:ss.SSSSSSZ'. To convert these into data flow parameters of type timestamp, use string interpolation to include the desired timestamp in a `toTimestamp()` function. For example, to convert the pipeline trigger time into a data flow parameter, you can use `toTimestamp(left('@{pipeline().TriggerTime}', 23), 'yyyy-MM-dd\'T\'HH:mm:ss.SSS')`.
83+
84+
:::image type="content" source="media/data-flow/parameter-timestamp.png" alt-text="Screenshot shows the Parameters tab where you can enter a trigger time.":::
85+
86+
> [!NOTE]
87+
> Data Flows can only support up to 3 millisecond digits. The `left()` function is used trim off additional digits.
88+
89+
#### Pipeline parameter example
90+
91+
Say you have an integer parameter `intParam` that is referencing a pipeline parameter of type String, `@pipeline.parameters.pipelineParam`.
92+
93+
:::image type="content" source="media/data-flow/parameter-pipeline-2.png" alt-text="Screenshot shows the Parameters tab with parameters named stringParam and intParam.":::
94+
95+
`@pipeline.parameters.pipelineParam` is assigned a value of `abs(1)` at runtime.
96+
97+
:::image type="content" source="media/data-flow/parameter-pipeline-4.png" alt-text="Screenshot shows the Parameters tab with the value of a b s (1) selected.":::
98+
99+
When `$intParam` is referenced in an expression such as a derived column, it will evaluate `abs(1)` return `1`.
100+
101+
:::image type="content" source="media/data-flow/parameter-pipeline-3.png" alt-text="Screenshot shows the columns value.":::
102+
103+
### Data flow expression parameters
104+
105+
Select **Data flow expression** will open up the data flow expression builder. You'll be able to reference functions, other parameters and any defined schema column throughout your data flow. This expression will be evaluated as is when referenced.
106+
107+
> [!NOTE]
108+
> If you pass in an invalid expression or reference a schema column that doesn't exist in that transformation, the parameter will evaluate to null.
109+
110+
111+
### Passing in a column name as a parameter
112+
113+
A common pattern is to pass in a column name as a parameter value. If the column is defined in the data flow schema, you can reference it directly as a string expression. If the column isn't defined in the schema, use the `byName()` function. Remember to cast the column to its appropriate type with a casting function such as `toString()`.
114+
115+
For example, if you wanted to map a string column based upon a parameter `columnName`, you can add a derived column transformation equal to `toString(byName($columnName))`.
116+
117+
:::image type="content" source="media/data-flow/parameterize-column-name.png" alt-text="Passing in a column name as a parameter":::
118+
119+
> [!NOTE]
120+
> In data flow expressions, string interpolation (substituting variables inside of the string) isn't supported. Instead, concatenate the expression into string values. For example, `'string part 1' + $variable + 'string part 2'`
121+
122+
## Next steps
123+
* [Execute data flow activity](control-flow-execute-data-flow-activity.md)
124+
* [Control flow expressions](control-flow-expression-language-functions.md)

includes/azure-data-factory-limits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Azure Data Factory is a multitenant service that has the following default limit
4242
| Monitoring queries per minute | 1,000 | 1,000 |
4343
| Maximum time of data flow debug session | 8 hrs | 8 hrs |
4444
| Concurrent number of data flows per integration runtime | 50 | [Find out how to request a quota increase from support](https://azure.microsoft.com/blog/azure-limits-quotas-increase-requests/). |
45-
| Concurrent number of data flows per integration runtime in managed vNet| 20 | [Find out how to request a quota increase from support](https://azure.microsoft.com/blog/azure-limits-quotas-increase-requests/). |
45+
| Concurrent number of data flows per integration runtime in managed vNet| 50 | [Find out how to request a quota increase from support](https://azure.microsoft.com/blog/azure-limits-quotas-increase-requests/). |
4646
| Concurrent number of data flow debug sessions per user per factory | 3 | 3 |
4747
| Data Flow Azure IR TTL limit | 4 hrs | 4 hrs |
4848
| Meta Data Entity Size limit in a factory | 2 GB | [Find out how to request a quota increase from support](https://azure.microsoft.com/blog/azure-limits-quotas-increase-requests/). |

0 commit comments

Comments
 (0)