简体   繁体   中英

ADF Copy Activity with Additional Columns is Not working

My goal is to add some text to a file. I used this post here to help me design this setup.

I have a set variable that sets a variable with some value. I then have a copy activity. This copy activity has an empty file for the source. I then add in an additional column that uses my set variable. In sink I have a different file I hope to copy the contents of set variable to. When I run in debug mode, the sink file ends up empty. The additional column is not being copied over. I tried with a mapping and then without. In both cases the same thing happened. 设置变量 复制活动源 复制活动接收器 复制活动映射

Does anyone have any ideas or tips?

I have tried and also seen the same empty data in the sink file as you mentioned.

在此处输入图像描述

Sink file:

在此处输入图像描述

You can raise the support ticket or feel free to post your question in Microsoft Q&A forum where the product team will monitor them closely.

I'm not sure the file based copy activity is supposed to work this way, you need input data/rows for it to enumerate. If you have access to SQL server then you could simulate a dynamic SQL query to include the contents of your variable as a tabular output. This can then define a source set of rows that could be appended into a file.

For example, SQL for Source Query :

/*
    Bring in the value from your variable. use @@ to escape the SQL parameter name
    NOTE: Do not forget to escape single quotes if they exist in your string, replace ' with ''
*/
declare @@my_sql_var nvarchar(max) = '@{variables('fileContents')}';

/*
    Do some work here with this variable 
*/

/*
    Return the tabular response for the copy activity source query.
*/

select @@my_sql_var [VariableName];

Copy Activity - SQL Source

在此处输入图像描述

Dynamic Expression for Source Query

在此处输入图像描述

Preview Output

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM