Medium severitydata source
Power BI Refresh Error:
DF-MSSQL-InvalidDataType
What does this error mean?
A column in the SQL Server source or sink has a type that ADF Mapping Data Flows cannot map to a Spark type — SQL Server-specific types like sql_variant, hierarchyid, geometry, or geography. ADF's schema import may silently map these to unsupported types, and the error only surfaces at runtime when Spark tries to read or write the column.
Common causes
- 1The SQL table contains sql_variant, hierarchyid, geometry, geography, or XML columns that ADF cannot map to a supported Spark type
- 2A sink column was changed from a supported type (e.g., nvarchar) to an unsupported type (e.g., sql_variant) without updating the ADF schema
- 3The schema was imported when the table had different column types, and the stored ADF schema is now stale
- 4An explicit CAST to an unsupported SQL Server type is in the derived column expression
How to fix it
- 1In ADF Studio, open the failing Source or Sink transformation and click 'Import schema' to refresh the column list.
- 2Identify the problematic column from the ADF Monitor error detail (it shows the column name and type).
- 3Add a Derived Column transformation to cast the unsupported column to STRING: `toString(problematicColumn)`.
- 4For geometric or geographic types, consider converting to WKT (Well-Known Text) in SQL using `yourColumn.STAsText()` before ADF reads it.
- 5If the column is not needed in the data flow output, exclude it by removing it from the Source projection.
Frequently asked questions
Official documentation: https://learn.microsoft.com/en-us/azure/data-factory/data-flow-troubleshoot-guide