• Stars
    star
    818
  • Rank 53,465 (Top 2 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created 8 months ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

DoltgreSQL - Version Controlled PostgreSQL

DoltgreSQL is Dolt for Postgres!

From the creators of Dolt, the world's first version controlled SQL database, DoltgreSQL (aka Doltgres) is a Postgres-flavored version of Dolt. Doltgres offers all the Git-style log, diff, branch, and merge functionality of Dolt on your Postgres database schema and data. Instead of connecting with a MySQL client and using MySQL SQL, you connect to Doltgres with a Postgres client and use Postgres SQL. Doltgres is like Git and Postgres had a baby.

Motivation

Dolt was built MySQL-flavored. There is no MySQL code in Dolt. In 2019, when we were conceiving of Dolt, MySQL was the most popular SQL-flavor. Over the past 5 years, the tide has shifted more towards Postgres, especially among young companies, Dolt's target market. Potential customers have been clamoring for a Postgres version of Dolt.

Moreover, Dolt was conceived of and built as Git for Data. Dolt later became a version controlled database. DoltgreSQL gives us the opportunity to strip out some of the Git for Data pieces like the CLI and build directly for the version controlled database use case. With Doltgres, you start a server, connect a client, and do everything with SQL, a familiar experience for Postgres users.

Doltgres will diverge from Dolt over time to be a focused database version control solution. That said, we have a five year head start with Dolt. Dolt is a production-grade version controlled database today. Dolt is 1.0. If you are ok with using a MySQL-client, we recommend using Dolt for all use cases. Doltgres is experimental.

How You Can Help

Doltgres is experimental. We need your feedback to understand how much we should invest in it. If you are interested in using Doltgres now or in the future, please:

Getting Started

  1. Download the latest release of doltgres

  2. Put doltgres on your PATH

  3. Run doltgres. This will create a doltgres user and a doltgres database in ~/doltgres/databases (add the --data-dir argument or change the DOLTGRES_DATA_DIR environment variable to use a different directory).

$ doltgres
Successfully initialized dolt data repository.
Starting server with Config HP="localhost:5432"|T="28800000"|R="false"|L="info"|S="/tmp/mysql.sock"
  1. Make sure you have Postgres version 15 or higher installed. I used Homebrew to install Postgres on my Mac. This requires I manually add /opt/homebrew/opt/postgresql@15/bin to my path. On Postgres version 14 or lower, \ commands (ie. \d, \l) do not yet work with Doltgres.
export PATH="/opt/homebrew/opt/postgresql@15/bin:$PATH"
  1. Open a new terminal. Connect with the following command: psql -h localhost -U doltgres. This will connect to the doltgres database with the doltgres user.
$ psql -h 127.0.0.1 -U doltgres
psql (15.4 (Homebrew), server 15.0)
Type "help" for help.

doltgres=>
  1. Create a getting_started database. Create the getting_started example tables.
doltgres=> create database getting_started;
--
(0 rows)

doltgres=> \c getting_started;
psql (15.4 (Homebrew), server 15.0)
You are now connected to database "getting_started" as user "doltgres".
getting_started=> create table employees (
    id int8,
    last_name text,
    first_name text,
    primary key(id));
--
(0 rows)

getting_started=> create table teams (
    id int8,
    team_name text,
    primary key(id));
--
(0 rows)

getting_started=> create table employees_teams(
    team_id int8,
    employee_id int8,
    primary key(team_id, employee_id),
    foreign key (team_id) references teams(id),
    foreign key (employee_id) references employees(id));
--
(0 rows)

getting_started=> \d
              List of relations
 Schema |      Name       | Type  |  Owner   
--------+-----------------+-------+----------
 public | employees       | table | postgres
 public | employees_teams | table | postgres
 public | teams           | table | postgres
(3 rows)
  1. Make a Dolt Commit.
getting_started=> select * from dolt_status;
   table_name    | staged |  status   
-----------------+--------+-----------
 employees       | 0      | new table
 employees_teams | 0      | new table
 teams           | 0      | new table
(3 rows)

getting_started=> call dolt_add('teams', 'employees', 'employees_teams');
 status 
--------
      0
(1 row)
getting_started=> select * from dolt_status; 
   table_name    | staged |  status   
-----------------+--------+-----------
 employees       | 1      | new table
 employees_teams | 1      | new table
 teams           | 1      | new table
(3 rows)

getting_started=> call dolt_commit('-m', 'Created initial schema');
               hash               
----------------------------------
 peqq98e2dl5gscvfvic71e7j6ne34533
(1 row)
  1. View the Dolt log.
getting_started=> select * from dolt_log;
           commit_hash            | committer |       email        |        date         |          message           
----------------------------------+-----------+--------------------+---------------------+----------------------------
 peqq98e2dl5gscvfvic71e7j6ne34533 | doltgres  | [email protected] | 2023-11-01 22:08:04 | Created initial schema
 in7bk735qa6p6rv6i3s797jjem2pg4ru | timsehn   | [email protected]    | 2023-11-01 22:04:03 | Initialize data repository
(2 rows)
  1. Continue with Dolt Getting Started to test out more Doltgres versioning functionality.

Building From Source

Please follow the Contributor's Guide to learn how to build from source.

Limitations

  • No Git-style CLI for version control like in Dolt, only a SQL interface.
  • Can't push to DoltHub or DoltLab, only custom remotes.
  • Limited support of Postgres-specific types and functions.
  • No Postgres system tables.
  • No authentication or users.
  • Database and schema models are merged.
  • Limited support for SSL connections (non-verified connections only).
  • No GSSAPI support.
  • No PostgreSQL functions have been implemented, therefore only MySQL functions may be used.
  • No support for replication, clustering, etc.

Performance

Dolt is 1.7X slower than MySQL as measured by a standard suite of Sysbench tests.

Similar tests for Doltgres vs Postgres coming soon.

Correctness

Dolt is 99.99% compatible with MySQL based on a standard suite of correctness tests called sqllogictest.

A similar comparison for Doltgres coming soon.

Architecture

Doltgres emulates a Postgres server, including parsing Postgres SQL into an Abstract Syntax Tree (AST). This AST is converted to a form that can be interpreted by the Dolt engine. Doltgres uses the same SQL engine and storage format as Dolt.

Dolt has a unique architecure that allows for version control features at OLTP database performance. Doltgres uses the same architecture.

More Repositories

1

dolt

Dolt โ€“ Git for Data
Go
16,618
star
2

go-mysql-server

A MySQL-compatible relational database with a storage agnostic query engine. Implemented in pure Go.
Go
1,358
star
3

swiss

Golang port of Abseil's SwissTable
Go
435
star
4

maphash

Go
76
star
5

jsplit

A Go program to split large JSON files into many jsonl files
Go
54
star
6

doltpy

A Python API for Dolt
Python
53
star
7

data-analysis

Jupyter Notebook
43
star
8

pg2mysql

Script to convert Postgres dump files to MySQL dump files
Shell
31
star
9

dolthub-etl-jobs

ETL jobs that DoltHub maintained that load public data into DoltHub.
Python
17
star
10

dolthub-cypress

A suite of Cypress tests that runs against DoltHub (dolthub.com)
TypeScript
13
star
11

driver

Golang database/sql driver for Dolt
Go
12
star
12

bounties

Go
9
star
13

doltcli

Python
8
star
14

go-icu-regex

ICU Regular Expressions in Go
Go
8
star
15

aws-incident-manager-oncall-calendar-generator

Go
7
star
16

docs

Shell
6
star
17

grammar-crawler

Java
6
star
18

dolt-action

Shell
6
star
19

dolthub-issues

Issues for dolthub.com
4
star
20

doltlab-issues

Issue tracking for DoltLab
4
star
21

kedro-dolt

Kedro-Dolt Hook Plugin
Python
4
star
22

fuzzer

Fuzzer for Dolt repositories
Go
3
star
23

gsheets-to-csv

Python
3
star
24

dolt-integrations

Python
3
star
25

chat-bot-profanity-filter

Simple chat bot with a profanity filter built with data from https://www.dolthub.com/repositories/Liquidata/bad-words
Python
3
star
26

insert-batcher

Go
2
star
27

go-library-sample

This is a sample C++ application showing how to embed a Go library into C/C++
Go
2
star
28

hosted-issues

Issues for hosted.doltdb.com
2
star
29

gsheets-sync-demo

1
star
30

windows-msi-creator

One stop shop for creating Windows MSI binaries for Dolt releases.
Batchfile
1
star
31

dolt-wordpress

Wordpress plugin w/ Dolt
1
star
32

efcore-sample

Sample project using .NET Entity Framework Core to access a Dolt database
C#
1
star
33

ai-dungeon-scraper

Python
1
star
34

read-replication-demo

Shell
1
star
35

release-notes-generator

Automated release notes generation for GitHub project releases
Perl
1
star
36

query-faq-toy

Go
1
star
37

hosted-cypress

A suite of Cypress tests that runs against Hosted DoltDB (hosted.doltdb.com)
TypeScript
1
star
38

cold-marketing

cold email marketing emails
1
star
39

dolt-rest-example

Python
1
star
40

label-customer-issues

A GitHub Action to apply a label to issues and PRs created by authors who are not members of the team that owns a repo.
JavaScript
1
star