paone
paone

Reputation: 937

Azure data factory merge files and set content type

I am using a SQL Server query which would return the last 3 months since a customer last purchased a product. For instance, There's a customer 100 that last made a purchase in August 2022. The SQL query will return June, July, August. Which would be in the format 062022, 072022, 082022. Now I need to be able to pass these values to the Copy data activity REST api dataset Relative URL (/salemonyr/062022) in the ForEach activity. So, I'm now able to store the json document per iteration but even though I use Copy behavior-> Merge files it runs over 3 iterations to over-write the files and not merge files with 3 months of data.

enter image description here

Also, I want the content-type to be application/json.

enter image description here

How would we be able to merge files and set the right content-type?

Upvotes: 0

Views: 212

Answers (1)

Kranthi Pakala
Kranthi Pakala

Reputation: 1426

Since you are using ForEach and looping through each iteration it will generate individual files. So, first step would be to copy those 3 files (don't use merge files feature here) to an intermediate location and once all three are copied, have a subsequent copy activity outside of ForEach, which will point source to the folder which has 3 files copied earlier and sink to your desired location and use merge files option which will generate a single data file. Then have a subsequent web activity and call Set Blob Properties API to update the content type property of the merged file.

enter image description here

Upvotes: 1

Related Questions