DEV Community

loading...

How to generate Cosmos DB sample data

Kenichiro Nakamura
・2 min read

Do you need sample data for Cosmos DB? The easiest way (which I found so far) is to use import tool and sample data in json format.

Prerequisites

Setup Cosmos DB

First thing first. You need Cosmos DB account, database and collection.

I created volcanodb and volcanocollection.

Alt Text

Use migration tool to import sample data

This time, I use GUI tool. If you prefer CUI, run dt.exe instead.

1. Download pre-build binary or source code and build.

2. Open dtui.exe.

3. Click [Add files] and select VolcanoData.json in GUI.

Alt Text

4. Go to Cosmos DB page in Azure Portal and confirm connection string.

Alt Text

5. Add "Database=volcanodb" at the end of connection string and past it to migration tool. Click Verify.

Alt Text

6. Enter collection name and complete the wizard.

Once you complete all steps, sample data should be uploaded to your Cosmos DB collection.

Alt Text

Reference

Tutorial: Use Data migration tool to migrate your data to Azure Cosmos DB
Azure Cosmos DB Sample Data

Discussion (0)