How best to copy files from onprem to azure using the file content to create partitions using ADF

Tinashe Chinyati 156 Reputation points
2021-06-12T16:02:28.713+00:00

Hi, I have a folder with CSV files. I want to copy and create folder partitions in Azure datalake using the file content timestamp. How best should I approach this? I tried the lookup activity but the limitation of 5000 rows blocked me. Thanks for assisting

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

Accepted answer
  1. ShaikMaheer-MSFT 38,441 Reputation points Microsoft Employee
    2021-06-14T10:18:39.423+00:00

    Hello @Tinashe Chinyati ,

    Thank you for Clarifications on Query.

    Please check out the below detailed example, which implements dates hierarchy path.

    For example, let's assume I have two files in folder as below.

    105310-image.png

    Step 1: GetMetaData activity to get files from folder

    105280-getmetadataactivity.gif

    Step 2: Pass GetMetaDataAcitivity outout childItems to ForEach activity

    105345-foreachactivity.gif

    Step 3: Create date, month & date variables

    105372-createvariables.gif

    Step 4: Lookup activity to get first row from file

    105346-lookupactivity.gif

    Step 5: Set values in to 3 variables

    105347-setvariablevalues.gif

    Step 6: Copy activity to copy file to destination by creating path with date hierarchy

    105348-copy.gif

    Step 7: Final results

    105373-image.png

    Hope this helps. Do let us know if you any further queries.

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

    • Please accept an answer if correct. 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.

2 additional answers

Sort by: Most helpful
  1. Bedi,Bhawna 1 Reputation point
    2021-06-17T11:19:53.173+00:00

    Well explained!!! @ShaikMaheer-MSFT thankyou


  2. Tinashe Chinyati 156 Reputation points
    2021-06-19T21:05:18.397+00:00

    @ShaikMaheer-MSFT Thank you once again for the clear explain. following up on this discussion, we are able to create a date hierarchy using the file content itself, but it then copies the original file into that particular partition. How then do we ensure that we copy the corresponding details to that date. For example if we use Prop_0 column and partition using the date. I need to see test1 and 24 and all other details that fall within that date inside the partition. Another partition for 2021-07-02 will be created and Test 4 and 70 will be inside that partition and so on. Can you please assist with that. Thanks once again107283-test-case.png


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.