Rob Bowman
Rob Bowman

Reputation: 8741

Azure Data Factory Insert Child with Identity of Parent

I would like to create an Azure Data Factory Pipeline that will collect a number of csv files from an Azure Storage Blob Container, and insert data into an Azure Sql database. For each file, it should:

  1. Insert into parent table (CsvFiles)
  2. Use the value of the identity column generated from the previous step for the foreign key (CsvFilesId) when inserting data into child table (CsvFileRows)

data_model

CsvFiles.Id is an identity column, the value of which needs to be inserted into the foreign key column CsvFileRows.CsvFilesId

I've not been able to find any guidance on how to compose a pipeline for what I expected to be quite a common master/detail type load.

Does anyone know of any documentation that covers this please?

Upvotes: 0

Views: 1124

Answers (1)

Trent Tamura
Trent Tamura

Reputation: 1145

This is a fairly simple solution, no trigger needed. I will say, it only will work if FileName is a unique value in the CvsFiles table.

ADF Pipeline within For Each Copy Data to Child Table with additional column

Let me know if you need anything clarified, or need help with anything in detail, but this is just one simple solution that can be built within ADF entirely.

Upvotes: 1

Related Questions