Skip to content

Commit 7be9e75

Browse files
authored
Merge pull request #204684 from kromerm/cast
Cast
2 parents 621f545 + 9c73c60 commit 7be9e75

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

articles/data-factory/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,8 @@ items:
733733
href: data-flow-assert.md
734734
- name: Conditional split
735735
href: data-flow-conditional-split.md
736+
- name: Cast
737+
href: data-flow-cast.md
736738
displayName: split
737739
- name: Derived column
738740
href: data-flow-derived-column.md
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: Cast transformation in mapping data flow
3+
description: Learn how to use a mapping data flow cast transformation to easily change column data types in Azure Data Factory or Synapse Analytics pipelines.
4+
titleSuffix: Azure Data Factory & Azure Synapse
5+
author: kromerm
6+
ms.author: makromer
7+
ms.reviewer: makromer
8+
ms.service: data-factory
9+
ms.subservice: data-flows
10+
ms.topic: conceptual
11+
ms.custom: synapse
12+
ms.date: 07/13/2022
13+
---
14+
15+
# Cast transformation in mapping data flow
16+
17+
[!INCLUDE[appliesto-adf-asa-md](includes/appliesto-adf-asa-md.md)]
18+
19+
[!INCLUDE[data-flow-preamble](includes/data-flow-preamble.md)]
20+
21+
Use the cast transformation to easily modify the data types of individual columns in a data flow. The cast transformation also enables an easy way to check for casting errors.
22+
23+
## Configuration
24+
25+
:::image type="content" source="media/data-flow/cast-transformation-001.png" alt-text="Cast settings":::
26+
27+
To modify the data type for columns in your data flow, add columns to "Cast settings" using the plus (+) sign.
28+
29+
**Column name:** Pick the column you wish to cast from your list of metadata columns.
30+
31+
**Type:** Choose the data type to cast your column to. If you pick "complex", you can then select "Define complex type" and define structures, arrays, and maps inside the expression builder.
32+
33+
**Format:** Some data types, like decimal and dates, will allow for additional formatting options.
34+
35+
**Assert type check:** The cast transformation allows for type checking. If the casting fails, the row will be marked as an assertion error that you can trap later in the stream.
36+
37+
## Data flow script
38+
39+
### Syntax
40+
41+
```
42+
<incomingStream>
43+
cast(output(
44+
AddressID as integer,
45+
AddressLine1 as string,
46+
AddressLine2 as string,
47+
City as string
48+
),
49+
errors: true) ~> <castTransformationName<>
50+
```
51+
## Next steps
52+
53+
Modify existing columns and new columns using the [derived column transformation](data-flow-derived-column.md).
49.7 KB
Loading

0 commit comments

Comments
 (0)