0
votes

I am trying to migrate some data from a JSON file to Cosmos DB using Data Migration Tool, when I tried to define the partition key with either single or a combination of my column name, every time I am getting undefined partition key after migration, how could I correct this issue?

Note here I'll have to use Bulk import (single partition collections) options, because I need to execute my customized stored procedure for nested array import, I cannot use sequential record import as I know the same partition function works very well there.

So here I am setting my partition key to be "/item/vid":

enter image description here

After migration, my collection shows "_partitionKey" instead of "/item/vid" there:

enter image description here

1
do all your documents have a value in this path? If this isn't a valid path for every single document in the collection it won't work. - Nick Chapsas
You also need to change the format a little bit. The first forward slash is implied so you can change it to item/vid - Nick Chapsas
@NickChapsas, thanks for your advice, unfortunately I tried with item/vid or even vid without the slash and both are not working for me... - Kev D.

1 Answers

-1
votes

If you use Bulk import with migration tool, the partition key setting is for more than collection scenario.Please see the statement in this link:

When you import to more than one collection, the import tool supports hash-based sharding. In this scenario, specify the document property you wish to use as the Partition Key. (If Partition Key is left blank, documents are sharded randomly across the target collections.)

Back to your requirement,you could use Sequential Record Import.

enter image description here

You need to create collection first and set the partition key as /item/vid.

My test json file:

enter image description here

Result:

enter image description here