Dolt: The Database for Dummies

5 min read

Why name a product Dolt? We get asked all the time.

It's named dolt to pay homage to how Linus Torvalds named git:

Torvalds sarcastically quipped about the name git (which means "unpleasant person" in British English slang): "I'm an egotistical bastard, and I name all my projects after myself. First 'Linux', now 'git'."

We wanted a word meaning "idiot", starting with "D" for Data, short enough to type on the command line, and not taken in the standard command line lexicon. So, dolt.

But maybe we should start telling people, "Dolt is the database for dummies". Because it really is. Dolt makes databases foolproof. This blog will explain how.

For Dummies

Dolt is the database you can copy/paste

Copy/Paste

Dolt is a database where you can get your own copy. You don't need to be connected to a central server to grab the data and run queries. In Dolt parlance, making a copy is the dolt clone command. You can clone from any other Dolt database but the easiest place to clone a database from is DoltHub. DoltHub is a website that hosts Dolt databases for you to copy. When you run a dolt clone command, all the schema and data (and its history) is downloaded to the directory where you issued the clone command. Ctrl-C (Cmd-C on Mac) for databases.

Once you have the data, you can run SQL queries on the data offline using the dolt sql -q command. Or you can use the dolt sql-server command to start a server on your computer. Once you have a server you can connect to the database using any tool that can connect to MySQL, like Excel, R Studio, or TablePlus. All these tools are running against your own local copy. You can't break anyone else's copy, only your own! So run the dumbest delete or update queries you can imagine. You're only changing your copy.

Where does paste come in? Well, once your happy with the changes you made to your local copy, you save them permanently with the dolt commit command. Then, if you want those changes to be pasted, merged in Dolt terms, you run a dolt push command which pastes your changes back to DoltHub. There's a bit more complicated machinery going on here that you can learn later. But the main idea is: Make changes on your local copy, paste the changes back to the remote copy (on DoltHub) everyone else is using to make their copies.

You can even make this safer by making your changes on a branch so that the main copy on DoltHub is not affected by your paste directly. On DoltHub someone will have to take some extra steps to get your changes into the main copy of the database. We'll get to that later in the phone a friend section.

Making a database you can copy/paste makes databases much less scary and pretty foolproof. If you do something bad to your own copy, you only break yourself. But in that case, throw it away and get a new copy.

Dolt is the database with an undo button

Undo

Dolt is the database where every change can be undone. You have an undo button! You have a redo button!

Once you have your own copy and you start running SQL queries to change the database, the results of queries aren't stored permanently until you make a commit using the dolt commit command. If you ever are in a situation where you're like, "I screwed this up bad. UNDO!", your escape hatch is a command called dolt reset. There are two reset modes --hard and --soft. Hard is like "get me out of here quick" and soft is more like "don't do anything crazy to get me out of here but get me out of here". If you do a soft reset, you have a redo option.

You can also dolt checkout any commit in history, even those that aren't yours. A checkout makes your local database copy look like it did at that commit (or point in history). Like that version better? Start a new branch there and start making changes. Decide those changes are junk? Make a commit just incase you want to come back. Go back to the commit you started at using dolt checkout. Redo in action. The main takeaway is that you should make a commit at places you may want to undo to or redo between. Then there's a bunch of different ways you can undo and redo.

Dolt is the database with track changes

Track changes

Track changes is a feature in text editors, ie. Microsoft Word, where the changes a person makes to a document are presented as additions and deletions, usually with visual affordances (think strike through for deletes) to make interpreting the changes easier. Dolt has track changes for databases.

Dolt Track Changes

Dolt calls these visualizations of changes diffs, short for differences. You can create diffs between two commits or a commit and your current working copy using the dolt diff command. These diffs make it incredibly easy to understand what you changed in the database. Did you run a query you expected to modify one row and it ended up modifying three? Consult the diff of your changes to figure out why you did not get what you expected. In traditional databases, your write is made and you are left to wonder, "Did I just mess up this database real bad?" In Dolt, you can undo OR use diffs to figure out what you did.

Dolt is the database where you can phone a friend

Phone a Friend

We've established that Dolt is the database you can copy/paste and everyone can work on their own copy. Dolt is even better, a single person can have multiple copies, you can send your copy to other people, and other people can compare their copy to yours to help you out!

Help usually manifests in a form of human review called a pull request. It's a fancy technical term that describes a process that amounts to "Here are my changes. If they look good, let's make it so everyone can access them". You do pull requests on the remote copy of your database on DoltHub.

The above hinges on the idea that you are collaborating with a bunch of people on a central copy but you all have your own copies as well. You share changes with each other using dolt push, paste your changes, and dolt pull, paste their changes. If you want to ask for help, you push your changes and the person who wants to help you pulls your changes from the central copy. Again, a concept called branches adds an organizational layer to all this sharing. You can learn that later. Just know, with Dolt, you're not alone. People can help you.

Dolt is the database for dummies

As you can see, Dolt really makes working with databases foolproof. You get copy/paste, undo, and track changes. You can ask your friend for help. Sound interesting? Join us on our Discord to learn more. Or hop on over to our Getting Started documentation and start playing. Don't worry, you can't break anything.

SHARE

JOIN THE DATA EVOLUTION

Get started with Dolt

Or join our mailing list to get product updates.