简体   繁体   中英

Azure Cosmos DB - Gremlin API to clone existing collection into another collection

I have created a gremlin api database in Azure Cosmos DB and have data in one collection.

However, I want to know if there is a way to clone the data into another collection in another database.

I want to copy graph data from Dev environment to stage and prod environments.

You can use existing tools for cosmos SQL API(earlier known as documentdb), cosmosdb allows you to query graph via sql API as well

Something like "select * from c" can fetch you the json representation of how cosmosdb stores your graph data.

The simplest approach would be using cosmosdb migration tool :

  1. Set input source as Cosmos SQL API/Documentdb, and use your dev endpoint with the following query select * from c
  2. Set output type as json and export your data
  3. Now use the downloaded json as input source and set your prod graph db as your output(choose documentdb/cosmos SQL API as output type) and run it.

This should push your dev graph data to prod.

You can also use other Azure tools such as data factory, which work with documentdb

Just used this CosmicClone to clone a cosmos db graph database form one account to another https://github.com/microsoft/CosmicClone . Cloned 500k records in 20mins. Looks like it would work with a DB to clone a collection.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM