TOCB: Data Migration Tool For Couchbase

When I was working on my pet project, I had to copy data from MySQL database to Couchbase. I searched the internet to find a solution. I found couple scripts that would copy all MySQL tables into Couchbase. But I didn’t want just to copy tables. The Couchbase bucket structure in my mind was different than normalized sql tables.

Then a thought came to my mind that what if we move data by sql queries. You write a query in sql and the results will be copied to Couchbase.

So, I decided to write a small tool to implement that idea. The result: tocb.

Using tocb is very simple. You don’t need Go language knowledge except you’ll have to install the language. You can refer to README section of the repository about how to use the tool here: https://github.com/chapani/tocb

This tool is extensible as well. Just copy mysql.go to your databases name and modify it. Don’t forget to change “handler” property in your config.toml. Also, add another condition to tocb.go: https://github.com/chapani/tocb/blob/master/tocb.go#L41-L48