Dolt for Beginners: Dolt Workbench
The Dolt for Beginners series focuses on topics people getting started with Dolt will likely be interested in. Most of our other blog articles go pretty deep so we want a space to talk about topics that experts may find boring.
Beginners are generally comfortable getting started with Graphical User Interfaces (GUIs). Here at DoltHub, we have a few graphical user interfaces for beginners to start their Dolt journey with. Our newest GUI is the Dolt Workbench.
Dolt is a SQL database. The hook is Dolt is the world's first and only version controlled SQL database. The traditional GUI for a SQL database is a SQL Workbench. Some popular SQL workbenches include Datagrip and Tableplus. You can use any workbench that connects to MySQL with Dolt. But the Dolt Workbench is the only workbench that natively supports Dolt's version control features.
This article will explain how to get started with the Dolt Workbench and give you a quick tour of its features. In our opinion, the Dolt Workbench is the best way for a Dolt beginner to "tour the product".
Download and Install the Workbench
First you must install the Dolt Workbench. The Dolt Workbench is a standard desktop application. It is available in both the Mac and Windows App Stores or you can download the appropriate installer from GitHub.
Once you have it installed launch it like you would launch any other Desktop application.
After Starting the Dolt Workbench you are prompted to connect to a database server. The Dolt Workbench works with any MySQL- or Postgres-compatible database.
Create a Database
I have a bunch of connections to various databases but you won't have one as a beginner. So click the "Add Connection" button.
The Dolt Workbench recently started to ship with built-in Dolt. This is great news for beginners because you no longer need to touch a Terminal to try Dolt. Just download the Dolt Workbench and use the "Start a Dolt server" option!
Give your database a name like "local-dolt" and a port like 3658 (ie. d-o-l-t
on a numeric keypad). Then, click the "Start and Connect to Dolt Server" button. You will be greeted by a brand new, fresh Dolt database, no tables, just an initial commit.
Make a Table
A database isn't very fun without a table. If you've been following along with my other Dolt for Beginners articles, you'll know we've been using the same example tables in the commits and branches articles. We'll use the same one here.
To run SQL in the Dolt Workbench, there is a query box, much like most other workbenches. It currently says CREATE TABLE tablename (pk INT, col1 VARCHAR(255), PRIMARY KEY (pk));
to give you the hint that you should create a table using SQL. We click on that text and then change that query to be:
create table people (
id int primary key,
first_name varchar(100),
last_name varchar(100)
);
Then we click the "play" button on the right of the query box to run the SQL. After we run the query, we are presented with our first version control feature, a diff of what we've changed. If you know SQL but not Dolt, this should be the first of many "Wow!" moments for you. Dolt can tell you what your SQL changed.
I now have a people
table and I can view it by clicking it in the left navigation section.
For any user familiar with other SQL workbenches this all should feel familiar and natural.
Make a Dolt Commit
You may have notices that the table view has an "Uncommitted changes." status message and a "Create Commit" button on the top right. The easiest way to create a Dolt commit is to click the "Create Commit" button. After clicking the button you are prompted to eneter a commit message. I enter "Created people table" and click Commit.
The commit succeeds. The SQL query box shows me the SQL that was run CALL DOLT_COMMIT('-Am', 'Created people table');
and the commit hash that was created as a result, 3c93v5ijkiro2tvbpsgeonq87gnjbhmp
. As you can see, The Dolt Workbench exposes SQL and version control concepts in a manner such that a beginner can both make progress and learn what is happening behind the scenes. In my opinion, it's the best way for a beginner to explore Dolt.
Now let's examine the commit log to make sure our commit is there. Indeed it is.
Finish Your Tour
The Workbench has an intuitive Graphical User Interface for every Git feature: commits, branches, merges, and even remotes. Start clicking around and exploring all of Dolt's unique version control features. The Dolt Workbench is an ideal interface for beginners. More questions? Check out the rest of our Dolt for Beginners series or come by our Discord and ask us questions. We're here to help.