I have a sink in a data flow pointed to AzureSQL. There is a set of columns that were at one time booleans, which are now strings. I cannot for the life of me get ADF to change the data type in the output table.
I have tried:
I also get this funny message at the top of the Sink block->Mapping menu, even given the above:
At least one incoming column is mapped to a column in the sink dataset schema with a conflicting type, which can cause NULL values or runtime errors. So it obviously knows there's a difference, but everywhere else I've used this sink pattern, ADF will just go "New schema, here ya go" when I drift it in the flow.
What am I doing wrong?
The above warning arises when the sink dataset schema is not aligned with the incoming data schema. In this case, the source data types are strings and sink table data types are booleans.
This is my sink table schema before the dataflow run.
To change the sink table data types as per the incoming data, first you need to clear the sink table's schema in the sink dataset. If you keep the old schema here, even if you recreated the table from the dataflow, it would take this schema only. This also avoids the above warning in the dataflow mapping.
Now, go to the dataflow sink and enable the Allow schema drift and Recreate table option in the sink settings as well. Change your source data data types in the projection or use any transformations in between as per your requirement.
Now, run the dataflow, it will drop the old table and recreates the new table with the required schema as expected.