Cast transformation in mapping data flow
APPLIES TO: Azure Data Factory Azure Synapse Analytics
Data flows are available both in Azure Data Factory and Azure Synapse Pipelines. This article applies to mapping data flows. If you are new to transformations, please refer to the introductory article Transform data using a mapping data flow.
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.
To modify the data type for columns in your data flow, add columns to "Cast settings" using the plus (+) sign.
Column name: Pick the column you wish to cast from your list of metadata columns.
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.
Support for complex data type casting from the Cast transformation is currently unavailable. Use a Derived Column transformation instead. In the Derived Column, type conversion errors always result in NULL and require explicity error handling using an Assert. The Cast transformation can automatically trap conversion errors using the "Assert type check" property.
Format: Some data types, like decimal and dates, will allow for additional formatting options.
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.
Data flow script
<incomingStream> cast(output( AddressID as integer, AddressLine1 as string, AddressLine2 as string, City as string ), errors: true) ~> <castTransformationName<>
Modify existing columns and new columns using the derived column transformation.
Submit and view feedback for