1
votes

I've an azure cosmosdb database which I want to migrate to different cosmosdb environments. Firstly, I want to migrate the database from azure platform into my local azure emulator. I've tried the following command

dt.exe /s:DocumentDB /s.ConnectionString:"AccountEndpoint=https://portfolio.documents.azure.com:443/;AccountKey=EAXW4PkLzoWsDLMVSOsKh3o5sbMiI4ggIlBLbsQ8hM1B07yHxMFbsqHDAv1AmCqisRrdwJsPgJqsYXBMWx4VNUA==;Database=DailyPortfolio;" /s.Collection:Schemes /t:DocumentDBBulk /t.ConnectionString:"AccountEndpoint=https://localhost:8081;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;Database=DailyPortfolio;" /t.Collection:Schemes /t.PartitionKey:/SchemeId /t.CollectionThroughput:2500

I am getting the following error,

Failures:
5801E67E-3A37-44A0-9073-09F98F63CD40: PartitionKey value must be supplied for this operation.

But I've supplied the /t.PartitionKey:/SchemeId and also I've tried as follows /t.PartitionKey:"/SchemeId" but still I get the same error.

It works perfectly fine with the graphical tool dtui.exe

Any ideas?

2
can you try removing the leading slash in the partition key property name? - Mark Brown
I've tried, it returned the same error - Garry A
I have removed the /t.CollectionThroughput:2500 and worked! - Garry A
@GarryA You can post an answer to end this question. - Steve Zhao
Here you go, dt.exe /s:DocumentDB /s.ConnectionString:"AccountEndpoint=portfolio.documents.azure.com:443/…;" /s.Collection:Schemes /t:DocumentDBBulk /t.ConnectionString:"AccountEndpoint=localhost:8081;AccountKey=C2y6yDjf5/…;" /t.Collection:Schemes /t.PartitionKey:/SchemeId - Garry A

2 Answers

0
votes

Removed the /t.CollectionThroughput:2500 and worked.

dt.exe /s:DocumentDB /s.ConnectionString:"AccountEndpoint=https://portfolio.documents.azure.com:443/;AccountKey=EAXW4PkLzoWsDLMVSOsKh3o5sbMiI4ggIlBLbsQ8hM1B07yHxMFbsqHDAv1AmCqisRrdwJsPgJqsYXBMWx4VNUA==;Database=DailyPortfolio;" /s.Collection:Schemes /t:DocumentDBBulk /t.ConnectionString:"AccountEndpoint=https://localhost:8081;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;Database=DailyPortfolio;" /t.Collection:Schemes /t.PartitionKey:/SchemeId
0
votes

Bulk import mode is only for single partition Collections (no partition key). When importing data into a Collection that has a partition key defined, sequential record import mode must be used. So instead of /t:DocumentDBBulk, use:

/t:DocumentDB

I don't know why the bulk import mode contains the /t.PartitionKey option, it doesn't seem to work.

In the graphical tool dtui.exe, the sequential mode is chosen by default so it's easy to miss that option in the command-line tool.