Tuesday, April 11, 2023

New Data Migration Tool for Azure Cosmos DB, SQL Server, Mongo DB, Azure Table and JSON

     Migrating databases to a new database server is a big job. You need to have the right tools to make this process easy for everyone. Cosmos DB had a Data Migration Tool to move data from a bunch of sources. It was a great, free tool with an easy user interface. You didn't have to be a developer to use this tool. Here is a screenshot of what it used to look like.


     Unfortunately, the tool got old and did not get updated with upcoming SDK changes. It worked only in Windows environments too. It looks like Solliance is trying to bring this useful tool back to life. The new version of the tool looks nothing like the older version. You need to have .NET and C# knowledge to download and use this tool. You can download the latest version from this link. Azure Cosmos DB and most of its tools are very developer friendly. If you want to learn how to use or manage Azure Cosmos DB, It can be a challenge if you are not a developer. I hope the newer version of the Data Migration Tool will introduce some type of user interface. The new tool is very flexible, out of the box it supports importing/exporting options for Azure Table API, Azure Cosmos DB, SQL Server, Mongo DB, and raw JSON file/s. It is pretty easy to add new options to this list. This is an open-source project, and I am sure we will see more source/destination options in the future. Here is what the tool looks like when you type dmt in the command prompt.      

     You need to look at the migrationsettings.json file to configure source and destination settings. In the following example, I will try to import data from SQL Server into Cosmos DB. My source will be SQL Server and Sink will be Azure Cosmos DB. You can easily find what settings you might need for the source and sink by finding README.md file under the Extensions folder.


     To migrate data from SQL Server to Azure Cosmos DB. First I add the connection string and the query that will get executed to load data into the SourceSettings section of the migrationsettings.json. Then I will add the Azure Cosmos DB connection string, database name, and container name under the SinkSettings part. All the other options you see under Azure Cosmos DB are optional. I used Azure Cosmos DB Emulator for this example.


     When I execute and select 5:SqlServer for Source, and 2:Cosmos-nosql for Sink, the application gets the data from SQL Server and sends it to Azure Cosmos DB as you can see in this screenshot.


     The Application works great for Azure Cosmos DB, It is very easy to add new data sources/destinations. I am happy to see the Data Migration Tool in action for Azure Cosmos DB. This tool is not only for Azure Cosmos DB! You can easily migrate data from SQL Server to Mongo DB or Mongo DB to a raw JSON file. Any of the sources you select can write data to any destinations in that list. Azure Cosmos Db is only one of these options!





No comments:

Post a Comment