Is it possible to add "Additional Columns" to Azure Data Factory in Copy Activity using "add dynamic content"?

Gieger, Alfred 141 Reputation points
2023-09-05T09:42:42.49+00:00

In an old thread (https://learn.microsoft.com/en-us/answers/questions/435405/it-is-possible-to-add-additional-columns-to-azure) this question has already been asked, but I want to resume the discussion and extend the question a bit.

I have the problem, that I would like to add a column to my copied data (with a source dataset linked to SAP), which contains the query timestamp, or in other words, the timestamp of when the copy activity is executed. I have found a way to achieve that, if the column name for this column is fixed:

User's image

As you can see, my activity is quite generic, it should be usable for various tables. Now it could happen, that my source table already has a column "query_datetime" with a different meaning (I know, that is very improbable for SAP sources, but the idea should also be applicable to other types of data sources). In that case I would have to choose a different name. So I would like to pass the name of that additional column in a pipeline parameter.

If I click into the field with the name of the column, the typical "Add dynamic content" appears, which leads me to the expression editor. But this expression is supposed to be of an array type, because it apparently does not refer only to the name of one particular additional column, but to a complete list of additional columns. Is there a way to populate this expression (using array variables, lookup-activity results or anything else). I did not find anything about the type of the elements of the required array in the documentation.

Note: I do not want to generate the entire pipeline programatically, but just the name of the additional column.

Thx

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,625 questions
{count} votes

Accepted answer
  1. KranthiPakala-MSFT 46,642 Reputation points Microsoft Employee Moderator
    2023-09-07T00:19:34.23+00:00

    @Gieger, Alfred Welcome to Microsoft Q&A forum and thanks for reaching out here.

    Thank you for sharing detailed information about the experience you have gone through. I agree that there is not enough clarity or samples in the public document on how to utilize dynamic content feature in additional column feature in copy activity of ADF.

    But as called out in the documentation, the dynamic content more helpful when you want to define the value of column that is defined in additional column section.

    User's image

    The below setting of dynamic content is useful when you want to pass static column names and their value from pipeline parameters or pipeline variables at runtime as shown in below example.

    User's image

    For example, I have a parameter that holds the additional columns and their value to be passed dynamically to the source settings,

    Parameter details:
    Name: additionalColumns

    DefaultValue: [{"name": "<column1>", "value": "<value1>"}, {"name": "<column2>", "value": "<value2>"}]

    User's image

    In Copy activity source configuration, I can just refer to above additionalColumns parameter using dynamic content to define the additional columns and their values that I would like to copy to the respective sink data store.

    User's image

    And when you do a preview of source data it looks like below: including the additional columns defined using pipeline parameters.

    User's image

    Hope this clarifies. If you have any additional feedback regarding this feature or if you have any improvement suggestions, I recommend you to please submit your detailed feedback in IDEAS forum here : https://feedback.azure.com/d365community/forum/1219ec2d-6c26-ec11-b6e6-000d3a4f032c All the feedback shared in this forum are actively monitored and reviewed by respective product owners.

    Kindly share the feedback link once it is posted so that we can also share it with respective product owners to further review it.

    Also, we received your feedback that earlier answer provided by Subashri on the thread was not helpful.
    Kindly let us know what we could have done better to improve the answer and make your engagement experience good. We are here to help you and strive to make your experience better and greatly value your feedback.

    I have provided a detailed answer which clear steps on the feature usage, for which you are looking for.

    If you wish, you may consider re-surveying/rating for the engagement you received on the thread. Your feedback is very important to us.

    Looking forward to you reply. Much appreciate your feedback!  


    Please don’t forget to Accept Answer and Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.

    3 people found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Subashri Vasudevan 11,226 Reputation points
    2023-09-05T13:30:11.75+00:00

    Hi Gieger, Alfred

    you want to decide the name of the additional column based on the source columns. For instance, if the source column contains query_datetime column already, we need to name the additional column as query_datetime_derived may be?

    I doubt we can do that in copy activity additional column.

    IMO, It is better to choose the name of the additional column in such a way that its not quite obvious to be found in any of the sources.

    @Nandan Hegde please correct if i am wrong.

    1 person found this answer helpful.

  2. Gieger, Alfred 141 Reputation points
    2023-09-09T09:32:19.6+00:00

    Your explanation was exactly what I was looking for. I have learned from it more than I needed, for example, that setting a default value of a parameter is a practical way to generate a static array of objects. Unfortunately it does not yet completely solve my problem, because I still don't know how to generate an array of objects with dynamic values, which I could pass as an actual value for the parameter, in your example "additionalColumns". I would like to read the name of the additional column from a configuration file, and the value by evaluating an expression like "@utcnow()".


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.