Primary Key As a file Name

Harvail Singh 1 Reputation point
2022-05-18T07:55:44.467+00:00

I am fetching data from CRM system and trying to put in blob storage using Azure Data factory - copy activity.
I wanted to store each record in separate file with primary key as file name...
Any Suggestion please?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. KranthiPakala-MSFT 46,737 Reputation points Microsoft Employee Moderator
    2022-05-18T18:20:30.043+00:00

    Hello @Harvail Singh ,

    Thanks for the question and using MS Q&A platform.

    As lookup activity support Dynamics CRM, you can leverage it to make a lookup of your primary keys and have a subsequent ForEach activity to loop through the list of primary keys (each item in the loop == each Primary Key from CRM ), then inside For Each you can have a copy activity point to your source CRM and sink Azure Storage and in the source use a query to get the record for that particular primary key of that iteration and in the sink settings use that @concat(item.PrimaryKeyValue, '.csv') as file name while saving the data in your storage. (Please note you will be using @item.PrimaryKeyValue both in the source query and in the sink file name settings)

    Reference doc: Use the Lookup activity result

    203108-image.png

    Note: Below are current known limitations and possible workaround with lookup activity:

    203208-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
    0 comments No comments

  2. Harvail Singh 1 Reputation point
    2022-05-19T06:26:17.417+00:00

    @KranthiPakala-MSFT Thanks For replying.There is lot of valuable information.
    I am able to use @item.PrimaryKeyValue in source of the copy activity..but this option is not available in sink.
    My CRM System is Salesforce, so in source I am using Salesforce connection, it is working as you describes but in sink, I am not able parametrised file name using Foreach activity current item.

    0 comments No comments

Your answer

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