Azure / azure-documentdb-datamigrationtool

Azure DocumentDB Data Migration Tool
MIT License
387 stars 183 forks source link

Support for Arrays (Migrating data from SQL to Cosmos) #112

Closed deepakageeru closed 2 years ago

deepakageeru commented 4 years ago

This might be a duplicate of Issue 26, which is closed . However, just wanted to check if there is any solution or work around.

My requirement is similar to following example. Below are my SQL Server tables (SQL Server version: Microsoft SQL Azure (RTM) - 12.0.2000.8). Table: Person Columns: PersonId, Name

Table: Address - A person can have multiple addresses Columns: AddressId, AddressType, Line1, PersonId

Desired Object structure in Cosmos { PersonId: 1, Name: "abc", Addresses: [ // Array of addresses { Line1: "123 street", AddressType: "1" }, { Line1: "456 street", AddressType: "2" }, ] }

I can migrate a Person with single Address using "nesting operator". However, I need to have array of addresss. I have gone through this link but I don't think it will solve my problem.

Is there any solution or work around?

chr-knafl commented 3 years ago

We also had a migration scenario where we had to provide 1:n relationships. We worked around this by utilizing the openjson feature of sqlserver and providing the data as json file to the data migration tool.