I have source file with different record layouts and trying to load the data into same table in Synapse Analytics – dedicated sql spool. I am trying to use Dynamic Column mapping approach but getting an error
Steps : Set Variable
Copy Activity
File : dept.csv
SourceID,SourceName
1,HR
2,Finance
3,IT
4,Marketing
Table :
create table dept
(
dept_id INT,
dept_name VARCHAR(100),
location VARCHAR(100)
);
Error : Copy Activity Error :
"errors": [
{
"Code": 22301,
"Message": "Failure happened on 'Sink' side. ErrorCode=SqlOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A database operation failed. Please search error to get more details.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Data.SqlClient.SqlException,Message=Column count in target table does not match column count specified in input. If BCP command, ensure format file column count matches destination table. If SSIS data import, check column mappings are consistent with target.,Source=.Net SqlClient Data Provider,SqlErrorNumber=107098,Class=16,ErrorCode=-2146232060,State=1,Errors=[{Class=16,Number=107098,State=1,Message=Column count in target table does not match column count specified in input. If BCP command, ensure format file column count matches destination table. If SSIS data import, check column mappings are consistent with target.,}
Create Set Variable – Using Dynamic Mapping
{
“type”: “TabularTranslator”,
“mappings”: [
{
“source”: {
“name”: “SourceID”,
“type”: “int”,
“physicalType”: “String”
},
“sink”: {
“name”: “dept_id”,
“type”: “Int32”,
“physicalType”: “int”
}
},
{
“source”: {
“name”: “SourceName”,
“type”: “String”,
“physicalType”: “String”
},
“sink”: {
“name”: “dept_name”,
“type”: “String”,
“physicalType”: “varchar”
}
}
]
}