Dolt — Using SQL Database like Git
For today I review about fundamental of Git again because I forgot some content like Merge vs Rebase, Git workflow, Worktree, etc. Suddenly I found keyword Git for Data, so I’d know what is difference with Git, so I learn and write in this blog.
What is Dolt?
Dolt is opensource SQL database. You can run base command like Git for manage your data, create new branch, checkout to it, insert new data, commit them, get log information, and diff changed data. They have private and public repository on Dolthub.
Get NB’s stories in your inbox
Join Medium for free to get updates from this writer.
In my opinion, it’s so familiar with Git, but doesn’t exactly the same, because it focus on the data. It’s work well with Public Data Source.
Use Case
- For QA / tester, initial data set for test with SQL database in each branch such as data-set-for-integration-test, data-set-for-end-to-end-test. Switch branch into it when you need to test in difference data set.
- For infrastrucutre, snapshot data with specific table. Export and import them when need, and track changed data by log time, commit hash.
- For your teammate, you can share the data in your local machine with your team. Pull it in their machine, and merge your data with their data.
Dolt = Version Control of Data System
My Example
Create new database and table.
- Database name: dolt_example
- Table name: User (ID int)
Create new branch name
- master
- add-new-user
Insert new data into user table that data come from difference branch and merge them into master branch.
Insert new data (id = {6, 7, 8}) into user table and try to run data diff. You can run checkout for discard changes data if need.
Run snapshot data into dolt database with mysql compatible server. the database can CRUD from other process.
Insert data (id = 9) from other process via mysql compatible server, and data change immediately.
Commit new data change for backup into data revision
Export to sql command file for make sure data that should be backup
Import data from SQL command file. They force to do with dolt sql command
So I read file and send into stdin with pipe
Remove table user and import from sql command and checkout from revision HEAD for move to before remove table
This tool is very useful when you use to the right work, also concept of Git is very nice, and show me that we can adapt it with other problem solver, and make our working life easier. Thanks my reader. See you next blog. :)








