ADF Copy Dynamic Upsert Column Key

Duncan Bode 2 Reputation points
2022-03-31T14:54:27.767+00:00

Hi,

I am experiencing an error attempting an Upsert using the Copy activity in Data Factory.

In the Keys column I have used dynamic content to assign a variable to the Keys Column field with the primary key required for mapping the source to the target tables however it fails when debugging the pipeline with the following error..

Error:

ErrorCode=UserErrorUnexpectedObjectTypeInPayload,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=The value of property 'keys' is in unexpected type 'List`1'.,Source=Microsoft.DataTransfer.ClientLibrary,'

I don't understand what 'List 1' is refering to in the error message, it is definitally passing in the correct id as I can see this in the JSON produced from the run, any ideas?

188854-image.png

Thanks in advance!

Duncan

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

4 answers

Sort by: Most helpful
  1. AnnuKumari-MSFT 34,556 Reputation points Microsoft Employee Moderator
    2022-04-04T14:00:18.86+00:00

    Hi @Anonymous ,

    Welcome to Microsoft Q&A platform and thankyou for posting your query.

    As I understand your question here, you are trying to perform upsert on Azure SQL tables using Copy activity. In the sink settings, when you are trying to pass the key columns creating Variable it is failing .

    We are expected to pass the column list in the form of an Array. When we directly hardcode the column list in the KeyColumns , ADF creates it as the items of an array. Therefore, either directly supply the hardcoded key column values in the sink settings or create a variable with data type as array and use it as the Key Column to perform the upsert.

    189716-image.png

    In order to achieve the requirement of passing the Key Column via variable , we need to make the column as an Array data type as shown in the below screenshot.

    189775-image.png

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you.
      Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    4 people found this answer helpful.

  2. Céline Rodríguez 16 Reputation points
    2022-05-10T09:43:08.767+00:00

    HI! Have you tried the function array()?
    i.e. @array(concat(item().SourceTableName,'BK'))
    I create a composite BK in all my table and then use it in my upsert.

    3 people found this answer helpful.

  3. Andy Wilbourn 11 Reputation points
    2022-07-12T18:20:14.777+00:00

    I used a column to enter the column names separated by a comma and used the split(<column>, ',') that will result in returning an array. It works for me perfect.

    2 people found this answer helpful.

  4. Sujatha Pillai 11 Reputation points
    2022-12-13T05:36:53.717+00:00

    Hi All,

    The below functions array & split together is working for me

    @array(split(pipeline().parameters.Keycolumn,','))

    Also found in the below video
    https://www.youtube.com/watch?v=UGfJ3s9YGjs&t=1521s

    2 people found this answer helpful.

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.