Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
921 views
in Technique[技术] by (71.8m points)

Azure ADF Copy Activity with Trailing Column Delimiter

I have a strange source CSV file where it contains a trailing column delimiter at the end of each record just before the carriage return/new line.

FIRST_NAME,LAST_NAME,  Christiana,Bellerose,

When ADF is previewing this data, it displays only 2 columns without issue and all the data rows. However, when using the copy activity, it fails with the following exception.

ErrorCode=DelimitedTextColumnNameNotAllowNull,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=The name of column index 3 is empty. Make sure column name is properly specified in the header

Now I understand why it's complaining about this due to trailing delimiter, but my question is whether or not there is a way to deal with this condition? I've tried including the trailing comma in the record delimiter (, ), but then it just pivots the data where all the columns become rows.

Is there a way to address this condition in copy activity?

question from:https://stackoverflow.com/questions/65871486/azure-adf-copy-activity-with-trailing-column-delimiter

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

When preview the data in dataset, it seams correct: enter image description here

But actually in copy actives, the data will derived to 3 columns by the column delimiter ",", the third column is empty or NULL value. This will cause the error.

If you use Data Flow import projection from source, you can see the third column: enter image description here

Just for now, copy active doesn't support modify the data schema. You must use Data flow Derived Column to create a new schema for the source. For example: enter image description here

Then mapping the new column/schema to sink will solve the problem.

HTH.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...