Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Cosmos DB: Clone collection to another database

Currently I am trying to clone a cosmos db collection from one database to another database within the cosmos db. The API of the cosmos db is set to Mongo API.

I already tried to use Azure Data factory, but it looks like that there is no support for the Mongo API so far.

Has anyone an idea how to do this respective to efficiency, automation and performance?

Any ideas are appreciated.

like image 395
Fabian Avatar asked Jul 05 '18 07:07

Fabian


People also ask

Is Azure Cosmos DB deprecated?

The support for cosmos DB accounts using Azure storage explorer will be deprecated in future versions that is why you can see deprecated is showing besides cosmos DB accounts option.


2 Answers

You can use data Migration tool suggested by Microsoft to do the same.

There is no way to take a backup and import cosmosdb.

EDIT:

With the new Cosmic Clone tool, you can take a clone/backup with data/stored procedures/triggers/udf, etc. Read my blog on the same.

like image 77
Sajeetharan Avatar answered Sep 24 '22 06:09

Sajeetharan


I already tried to use Azure Data factory, but it looks like that there is no support for the Mongo API so far.

Actually, Cosmos DB Mongo API and SQL API are all belong to Azure Cosmos DB service.So , you still can create cosmos db linked service and dataset in the azure data factory for your database.

enter image description here

Then you could create copy activity to import data from one collection to another collection.

enter image description here

If you want to make it as an automation task, I suggest using following 2 ways to run the copy activity.

1.Azure Time Trigger Function.

2.Web job which is run in the background of Azure Web App.

Hope it helps you.Any concern, please feel free to let me know.

like image 34
Jay Gong Avatar answered Sep 22 '22 06:09

Jay Gong