[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-4784":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":23,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":46,"readmeContent":47,"aiSummary":48,"trendingCount":16,"starSnapshotCount":16,"syncStatus":49,"lastSyncTime":50,"discoverSource":51},4784,"dolt","dolthub\u002Fdolt","dolthub","Dolt – Git for Data","https:\u002F\u002Fwww.dolthub.com",null,"Go",23392,800,123,542,0,12,313,745,81,118.71,"Apache License 2.0",false,"main",[26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],"agent-memory","agent-memory-server","ai-agents","ai-database","data-version-control","data-versioning","database","database-version-control","database-versioning","decentralized-database","git","git-database","git-for-data","git-for-databases","git-sql","immutable-database","mariadb","mysql","sql","version-controlled-database","2026-06-12 04:00:22","\u003Cimg height=\"100\" src=\".\u002Fimages\u002FDolt-Logo@3x.svg\"\u002F>\n\n# Dolt is Git for Data!\n\nDolt is a SQL database that you can fork, clone, branch, merge, push\nand pull just like a Git repository. \n\nConnect to Dolt just like any MySQL database to read or modify schema \nand data. Version control functionality is exposed in SQL via system \ntables, functions, and procedures. \n\nOr, use the Git-like command line interface to import CSV files, commit \nyour changes, push them to a remote, or merge your teammate's changes.\nAll the commands you know for Git work exactly the same for Dolt. \n\nGit versions files. Dolt versions tables. It's like Git and MySQL had a\nbaby.\n\nWe also built [DoltHub](https:\u002F\u002Fwww.dolthub.com), a place to share\nDolt databases. We host public data for free. If you want to host\nyour own version of DoltHub, we have [DoltLab](https:\u002F\u002Fwww.doltlab.com). \nIf you want us to run a Dolt server for you, we have [Hosted Dolt](https:\u002F\u002Fhosted.doltdb.com). \n\nPrefer Postgres instead of MySQL? Try [Doltgres](https:\u002F\u002Fgithub.com\u002Fdolthub\u002Fdoltgresql), now\nin its Beta release.\n\n[Join us on Discord](https:\u002F\u002Fdiscord.com\u002Finvite\u002FRFwfYpu) to say hi and\nask questions, or [check out our roadmap](https:\u002F\u002Fdocs.dolthub.com\u002Fother\u002Froadmap) \nto see what we're building next.\n\n# Video Introduction\n\n[![Dolt Explainer Video](https:\u002F\u002Fimg.youtube.com\u002Fvi\u002FH2iZy0Cme10\u002Fmaxresdefault.jpg)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=H2iZy0Cme10)\n\n# What's it for?\n\nLots of things! Dolt is a generally useful tool with countless\napplications. But if you want some ideas, [here's how people are using\nit so far](https:\u002F\u002Fdolthub.com\u002Fblog\u002F2024-10-15-dolt-use-cases\u002F).\n\nDolt powers [Beads](https:\u002F\u002Fgithub.com\u002Fgastownhall\u002Fbeads) and \n[Gas Town](https:\u002F\u002Fgithub.com\u002Fsteveyegge\u002Fgastown). It's the best database \nfor agent memory, especially as you move up the ladder to multi-agent and \nmulti-machine workflows.\n\n# Dolt CLI\n\nThe `dolt` CLI has the same commands as `git`, with some extras.\n\n```\n$ dolt\nValid commands for dolt are\n                init - Create an empty Dolt data repository.\n              status - Show the working tree status.\n                 add - Add table changes to the list of staged table changes.\n                diff - Diff a table.\n               reset - Remove table changes from the list of staged table changes.\n               clean - Remove untracked tables from working set.\n              commit - Record changes to the repository.\n                 sql - Run a SQL query against tables in repository.\n          sql-server - Start a MySQL-compatible server.\n                 log - Show commit logs.\n              branch - Create, list, edit, delete branches.\n            checkout - Checkout a branch or overwrite a table from HEAD.\n               merge - Merge a branch.\n           conflicts - Commands for viewing and resolving merge conflicts.\n         cherry-pick - Apply the changes introduced by an existing commit.\n              revert - Undo the changes introduced in a commit.\n               clone - Clone from a remote data repository.\n               fetch - Update the database from a remote data repository.\n                pull - Fetch from a dolt remote data repository and merge.\n                push - Push to a dolt remote.\n              config - Dolt configuration.\n              remote - Manage set of tracked repositories.\n              backup - Manage a set of server backups.\n               login - Login to a dolt remote host.\n               creds - Commands for managing credentials.\n                  ls - List tables in the working set.\n              schema - Commands for showing and importing table schemas.\n               table - Commands for copying, renaming, deleting, and exporting tables.\n                 tag - Create, list, delete tags.\n               blame - Show what revision and author last modified each row of a table.\n         constraints - Commands for handling constraints.\n             migrate - Executes a database migration to use the latest Dolt data format.\n         read-tables - Fetch table(s) at a specific commit into a new dolt repo\n                  gc - Cleans up unreferenced data from the repository.\n       filter-branch - Edits the commit history using the provided query.\n          merge-base - Find the common ancestor of two commits.\n             version - Displays the current Dolt cli version.\n                dump - Export all tables in the working set into a file.\n```\n\n# Installation\n\nDolt is a single ~103 megabyte program. \n\n```bash\ndolt $ du -h \u002FUsers\u002Ftimsehn\u002Fgo\u002Fbin\u002Fdolt\n103M\t\u002FUsers\u002Ftimsehn\u002Fgo\u002Fbin\u002Fdolt\n```\n\nIt's really easy to install. Download it and put it on your `PATH`. \nWe have a bunch of ways to make this even easier for most platforms.\n\n## From Latest Release\n\nTo install on Linux or Mac based systems run this command in your\nterminal:\n\n```\nsudo bash -c 'curl -L https:\u002F\u002Fgithub.com\u002Fdolthub\u002Fdolt\u002Freleases\u002Flatest\u002Fdownload\u002Finstall.sh | bash'\n```\n\nThis will download the latest `dolt` release and put it in\n`\u002Fusr\u002Flocal\u002Fbin\u002F`, which is probably on your `$PATH`.\n\nThe install script needs sudo in order to put `dolt` in `\u002Fusr\u002Flocal\u002Fbin`. If you don't have root\nprivileges or aren't comfortable running a script with them, you can download the dolt binary\nfor your platform from [the latest release](https:\u002F\u002Fgithub.com\u002Fdolthub\u002Fdolt\u002Freleases), unzip it,\nand put the binary somewhere on your `$PATH`.\n\n### Linux\n\n#### Arch Linux\n\nDolt is packaged in the official repositories for Arch Linux.\n\n```\npacman -S dolt\n```\n\n### Mac\n\n#### Homebrew\n\nDolt is on Homebrew, updated every release.\n\n```\nbrew install dolt\n```\n#### MacPorts\n\nOn macOS, Dolt can also be installed via a [community-managed port](https:\u002F\u002Fports.macports.org\u002Fport\u002Fdolt\u002F) via [MacPorts](https:\u002F\u002Fwww.macports.org):\n\n```sh\nsudo port install dolt\n```\n\n### Windows\n\nDownload the latest Microsoft Installer (`.msi` file) in\n[releases](https:\u002F\u002Fgithub.com\u002Fdolthub\u002Fdolt\u002Freleases) and run\nit.\n\nFor information on running on Windows, see [here](https:\u002F\u002Fdocs.dolthub.com\u002Fintroduction\u002Finstallation\u002Fwindows).\n\n#### Chocolatey\n\nYou can install `dolt` using [Chocolatey](https:\u002F\u002Fchocolatey.org\u002F):\n\n```sh\nchoco install dolt\n```\n\n#### Docker\n\nThere are following official Docker images for Dolt:\n\n* [`dolthub\u002Fdolt`](https:\u002F\u002Fhub.docker.com\u002Fr\u002Fdolthub\u002Fdolt) for running Dolt\nas CLI tool.\n* [`dolthub\u002Fdolt-sql-server`](https:\u002F\u002Fhub.docker.com\u002Fr\u002Fdolthub\u002Fdolt-sql-server) for running Dolt in server mode.\n\n## From Source\n\nMake sure you have Go installed, and that `go` is in your path. Dolt has a dependency on [cgo](https:\u002F\u002Fpkg.go.dev\u002Fcmd\u002Fcgo), so you will need a working C compiler and toolchain as well.\n\nClone this repository and cd into the `go` directory. Then run:\n\n```\ngo install .\u002Fcmd\u002Fdolt\n```\n\nThe output will be in `$GOPATH\u002Fbin`, which defaults to `~\u002Fgo\u002Fbin`. To test your build, try:\n\n```\n~\u002Fgo\u002Fbin\u002Fdolt version\n```\n\n# Configuration\n\nVerify that your installation has succeeded by running `dolt` in your\nterminal.\n\n```\n$ dolt\nValid commands for dolt are\n[...]\n```\n\nConfigure `dolt` with your user name and email, which you'll need to\ncreate commits. The commands work exactly the same as git.\n\n```\n$ dolt config --global --add user.email YOU@DOMAIN.COM\n$ dolt config --global --add user.name \"YOUR NAME\"\n```\n\n# Getting started\n\n## Navigate to the directory where you would like your data stored\n\nDolt needs a place to store your databases. I'm going to put my databases in `~\u002Fdolt`. \n\n```bash\n% cd ~\n% mkdir dolt\n% cd dolt\n```\n\nAny databases you create will be stored in this directory. So, for this example, a directory named `getting_started` will be created here once you run `create database getting_started`. Navigating to `~\u002Fdolt\u002Fgetting_started` will allow you to access this database using the Dolt command line.\n\nNOTE: For this example, the `getting_started` directory will be created after you run `create database getting_started;` in a SQL shell in the [Create a schema section](#create-a-schema). Don't do anything except make the directory and navigate to it just yet.\n\n## Start a MySQL-compatible database server\n\nDolt ships with a MySQL compatible database server built in. To start it you use the command `dolt sql-server`. Running this command starts the server on port 3306. \n\n```bash\ndolt sql-server\nStarting server with Config HP=\"localhost:3306\"|T=\"28800000\"|R=\"false\"|L=\"info\"\n```\n\nYour terminal will just hang there. This means the server is running. Any errors will be printed in this terminal. Just leave it there and open a new terminal.\n\n## Connect with a MySQL client (up to version 8.4)\n\nIn the new terminal, we will now connect to the running database server using a client. Dolt also ships with a MySQL compatible client. \n\n```bash\n% dolt -u root -p \"\" sql\n# Welcome to the Dolt MySQL client.\n# Statements must be terminated with ';'.\n# \"exit\" or \"quit\" (or Ctrl-D) to exit.\nmysql>\n```\n\nIn the other terminal where you ran `dolt sql-server`, you'll see the following log line.\n\n```\n2022-06-06T13:14:32-07:00 INFO [conn 1] NewConnection {DisableClientMultiStatements=false}\n```\n\nYou are connected!\n\nWhile we're here let's grab a copy of MySQL so we can connect with that client. Head over to the [MySQL Getting Started](https:\u002F\u002Fdev.mysql.com\u002Fdoc\u002Fmysql-getting-started\u002Fen\u002F) documentation and install MySQL on your machine. I used [Homebrew](https:\u002F\u002Fbrew.sh\u002F) to install MySQL on my Mac: `brew install mysql@8.4`. Alternatively, you can install only the client component by running `brew install mysql-client@8.4`.\n\nNOTE: Make sure you install a MySQL 8.4 release. MySQL 8.4 is the current Long Term Support (LTS) release, meaning this is the stable and supported version of MySQL. MySQL 9.0 is also available, but is an \"innovation\" release, meaning it has more recent changes and features, but may not be as stable as the LTS release. The 9.0 release changes authentication support and isn't able to connect to a Dolt SQL server by default. You can install MySQL 8.4 with Homebrew by running `brew install mysql@8.4`. If you do want to use MySQL-9.0, read [our post on how to configure Dolt for `caching_sha2_password` authentication](https:\u002F\u002Fwww.dolthub.com\u002Fblog\u002F2024-12-11-mysql9-and-caching-sha2-auth-support\u002F). \n\nMySQL comes with a MySQL server called `mysqld` and a MySQL client called `mysql`. You're only interested in the client. After following the instructions from MySQL's documentation, make sure you have a copy of the `mysql` client on your path:\n\n```bash\n% mysql --version\nmysql  Ver 8.0.29 for macos12.2 on x86_64 (Homebrew)\n```\n\nNow, to connect the `mysql` client to Dolt, you are going to force the MySQL client through the TCP interface by passing in a host and port. The default is the socket interface which Dolt supports, but is only available on `localhost`. So, it's better to show off the TCP interface. The MySQL client also requires you specify a user, in this case `root`.\n\n```bash\n% mysql --host 127.0.0.1 --port 3306 -uroot\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 2\nServer version: 5.7.9-Vitess \n\nCopyright (c) 2000, 2022, Oracle and\u002For its affiliates.\n\nOracle is a registered trademark of Oracle Corporation and\u002For its\naffiliates. Other names may be trademarks of their respective\nowners.\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n\nmysql>\n```\n\nAgain, to ensure the client actually connected, you should see the following in the `dolt sql-server` terminal \n\n```\n2022-06-06T13:26:55-07:00 INFO [conn 2] NewConnection {DisableClientMultiStatements=false}\n```\n\nAs you can see, Dolt supports any MySQL-compatible client. Dolt ships with a client but you can use any MySQL client, like the one that comes with MySQL.\n\n## Create a schema\n\nNow we're actually ready to do something interesting. I'll stay in the `mysql` client and execute the following SQL statements to create a database called `getting_started`. The `getting_started` database will have three tables: `employees`, `teams`, and `employees_teams`.\n\n```\nmysql> create database getting_started;\nQuery OK, 1 row affected (0.04 sec)\n\nmysql> use getting_started;\nDatabase changed\nmysql> create table employees (\n    id int, \n    last_name varchar(255), \n    first_name varchar(255), \n    primary key(id));\nQuery OK, 0 rows affected (0.01 sec)\n\nmysql> create table teams (\n    id int, \n    team_name varchar(255), \n    primary key(id)); \nQuery OK, 0 rows affected (0.00 sec)\n\nmysql> create table employees_teams(\n    team_id int, \n    employee_id int, \n    primary key(team_id, employee_id), \n    foreign key (team_id) references teams(id), \n    foreign key (employee_id) references employees(id));\nQuery OK, 0 rows affected (0.01 sec)\n\nmysql> show tables;\n+---------------------------+\n| Tables_in_getting_started |\n+---------------------------+\n| employees                 |\n| employees_teams           |\n| teams                     |\n+---------------------------+\n3 rows in set (0.00 sec)\n```\n\nDolt supports foreign keys, secondary indexes, triggers, check constraints, and stored procedures. It's a modern, feature-rich SQL database.\n\n## Make a Dolt commit\n\nIt's time to use your first Dolt feature. We're going to make a Dolt [commit](https:\u002F\u002Fdocs.dolthub.com\u002Fconcepts\u002Fdolt\u002Fcommits). A Dolt commit allows you to time travel and see lineage. Make a Dolt commit whenever you want to restore or compare to this point in time.\n\nDolt exposes version control functionality through a Git-style interface. On the command line, Dolt commands map exactly to their Git equivalent with the targets being tables instead of files. In SQL, Dolt exposes version control read operations as [system tables](https:\u002F\u002Fdocs.dolthub.com\u002Fsql-reference\u002Fversion-control\u002Fdolt-system-tables) and version control write operations as [stored procedures](https:\u002F\u002Fdocs.dolthub.com\u002Fsql-reference\u002Fversion-control\u002Fdolt-sql-procedures). \n\nThe naming of the system tables and stored procedures follows the `dolt_\u003Ccommand>` pattern. So `dolt add` on the CLI becomes `dolt_add` as a stored procedure. Passing options also follows the command line model. For instance, to specify tables to add, send the table names in as options to the `dolt_add` procedure. For named arguments like sending a message into the `dolt_commit` command use two arguments in sequence like `('-m', 'This is a message')`. If you know Git, the version control procedures and system tables should feel familiar.\n\nSo, we add and commit our new schema like so.\n\n```\nmysql> call dolt_add('teams', 'employees', 'employees_teams');\n+--------+\n| status |\n+--------+\n|      0 |\n+--------+\n1 row in set (0.03 sec)\n\nmysql> call dolt_commit('-m', 'Created initial schema');\n+----------------------------------+\n| hash                             |\n+----------------------------------+\n| ne182jemgrlm8jnjmoubfqsstlfi1s98 |\n+----------------------------------+\n1 row in set (0.02 sec)\n\nmysql> select * from dolt_log;\n+----------------------------------+-----------+-----------------+-------------------------+----------------------------+\n| commit_hash                      | committer | email           | date                    | message                    |\n+----------------------------------+-----------+-----------------+-------------------------+----------------------------+\n| ne182jemgrlm8jnjmoubfqsstlfi1s98 | Tim Sehn  | tim@dolthub.com | 2022-06-07 16:35:49.277 | Created initial schema     |\n| vluuhvd0bn59598utedt77ed9q5okbcb | Tim Sehn  | tim@dolthub.com | 2022-06-07 16:33:59.531 | Initialize data repository |\n+----------------------------------+-----------+-----------------+-------------------------+----------------------------+\n2 rows in set (0.01 sec)\n```\n\nThere you have it. Your schema is created and you have a Dolt commit tracking the creation, as seen in the `dolt_log` system table.\n\nNote, a Dolt commit is different than a standard SQL transaction `COMMIT`. In this case, I am running the database with [`AUTOCOMMIT`](https:\u002F\u002Fdev.mysql.com\u002Fdoc\u002Frefman\u002F5.6\u002Fen\u002Finnodb-autocommit-commit-rollback.html) on, so each SQL statement is automatically generating a transaction `COMMIT`. If you want system to generate a Dolt commit for every transaction use the system variable, [`@@dolt_transaction_commit`](https:\u002F\u002Fdocs.dolthub.com\u002Fsql-reference\u002Fversion-control\u002Fdolt-sysvars#dolt_transaction_commit).\n\n## Insert some data\n\nNow, I'm going to populate the database with a few employees here at DoltHub. Then, I'll assign the employees to two teams: engineering and sales. The CEO wears many hats at a start up so he'll be assigned to multiple teams.\n\n```\nmysql> insert into employees values \n    (0, 'Sehn', 'Tim'), \n    (1, 'Hendriks', 'Brian'), \n    (2, 'Son','Aaron'), \n    (3, 'Fitzgerald', 'Brian');\nQuery OK, 4 rows affected (0.01 sec)\n\nmysql> select * from employees where first_name='Brian';\n+------+------------+------------+\n| id   | last_name  | first_name |\n+------+------------+------------+\n|    1 | Hendriks   | Brian      |\n|    3 | Fitzgerald | Brian      |\n+------+------------+------------+\n2 rows in set (0.00 sec)\n\nmysql> insert into teams values \n    (0, 'Engineering'), \n    (1, 'Sales');\nQuery OK, 2 rows affected (0.00 sec)\n\nmysql> insert into employees_teams values \n    (0,0), \n    (1,0), \n    (2,0), \n    (0,1), \n    (3,1);\nERROR 1452 (HY000): cannot add or update a child row - Foreign key violation on fk: `rv9ek7ft`, table: `employees_teams`, referenced table: `teams`, key: `[2]`\n```\n\nOops, I violated a constraint. It looks like I created the table with teams before employees. You should always specify your columns when you insert, not rely on natural ordering. Serves me right! Dolt comes with the full power of a modern SQL relational database to ensure data integrity.\n\n```\nmysql> insert into employees_teams(employee_id, team_id) values \n    (0,0), \n    (1,0), \n    (2,0), \n    (0,1), \n    (3,1);\nQuery OK, 5 rows affected (0.01 sec)\n\nmysql> select first_name, last_name, team_name from employees \n    join employees_teams on (employees.id=employees_teams.employee_id) \n    join teams on (teams.id=employees_teams.team_id) \n    where team_name='Engineering';\n+------------+-----------+-------------+\n| first_name | last_name | team_name   |\n+------------+-----------+-------------+\n| Tim        | Sehn      | Engineering |\n| Brian      | Hendriks  | Engineering |\n| Aaron      | Son       | Engineering |\n+------------+-----------+-------------+\n3 rows in set (0.00 sec)\n```\n\nLooks like everything is inserted and correct. I was able to list the members of the engineering team using that three table `JOIN`. Dolt supports up to twelve table `JOIN`s. Again, Dolt is a modern SQL relational database paired with Git-style version control.\n\n## Examine the diff\n\nNow, what if you want to see what changed in your working set before you make a commit? You use the `dolt_status` and `dolt_diff_\u003Ctablename>` system tables. \n\n```\nmysql> select * from dolt_status;\n+-----------------+--------+----------+\n| table_name      | staged | status   |\n+-----------------+--------+----------+\n| teams           |      0 | modified |\n| employees       |      0 | modified |\n| employees_teams |      0 | modified |\n+-----------------+--------+----------+\n3 rows in set (0.01 sec)\n\nmysql> select * from dolt_diff_employees;\n+--------------+---------------+-------+-----------+----------------+----------------+-----------------+---------+----------------------------------+-------------------------+-----------+\n| to_last_name | to_first_name | to_id | to_commit | to_commit_date | from_last_name | from_first_name | from_id | from_commit                      | from_commit_date        | diff_type |\n+--------------+---------------+-------+-----------+----------------+----------------+-----------------+---------+----------------------------------+-------------------------+-----------+\n| Sehn         | Tim           |     0 | WORKING   | NULL           | NULL           | NULL            |    NULL | ne182jemgrlm8jnjmoubfqsstlfi1s98 | 2022-06-07 16:35:49.277 | added     |\n| Hendriks     | Brian         |     1 | WORKING   | NULL           | NULL           | NULL            |    NULL | ne182jemgrlm8jnjmoubfqsstlfi1s98 | 2022-06-07 16:35:49.277 | added     |\n| Son          | Aaron         |     2 | WORKING   | NULL           | NULL           | NULL            |    NULL | ne182jemgrlm8jnjmoubfqsstlfi1s98 | 2022-06-07 16:35:49.277 | added     |\n| Fitzgerald   | Brian         |     3 | WORKING   | NULL           | NULL           | NULL            |    NULL | ne182jemgrlm8jnjmoubfqsstlfi1s98 | 2022-06-07 16:35:49.277 | added     |\n+--------------+---------------+-------+-----------+----------------+----------------+-----------------+---------+----------------------------------+-------------------------+-----------+\n4 rows in set (0.00 sec)\n```\n\nAs you can see from the diff I've added the correct values to the `employees` table. The values were previously `NULL` and now they are populated.\n\nLet's finish off with another Dolt commit this time adding all effected tables using `-am`.\n\n```\nmysql> call dolt_commit('-am', 'Populated tables with data');\n+----------------------------------+\n| hash                             |\n+----------------------------------+\n| 13qfqa5rojq18j84d1n2htjkm6fletg4 |\n+----------------------------------+\n1 row in set (0.02 sec)\n```\n\nYou can inspect the log using `dolt_log` and see which tables changed in each commit using an unscoped `dolt_diff`. Unscoped `dolt_diff` tells you whether schema, data, or both changed in that particular commit for the table.\n\n```\nmysql> select * from dolt_log;\n+----------------------------------+-----------+-----------------+-------------------------+----------------------------+\n| commit_hash                      | committer | email           | date                    | message                    |\n+----------------------------------+-----------+-----------------+-------------------------+----------------------------+\n| 13qfqa5rojq18j84d1n2htjkm6fletg4 | Tim Sehn  | tim@dolthub.com | 2022-06-07 16:39:32.066 | Populated tables with data |\n| ne182jemgrlm8jnjmoubfqsstlfi1s98 | Tim Sehn  | tim@dolthub.com | 2022-06-07 16:35:49.277 | Created initial schema     |\n| vluuhvd0bn59598utedt77ed9q5okbcb | Tim Sehn  | tim@dolthub.com | 2022-06-07 16:33:59.531 | Initialize data repository |\n+----------------------------------+-----------+-----------------+-------------------------+----------------------------+\n3 rows in set (0.00 sec)\n\nmysql> select * from dolt_diff;\n+----------------------------------+-----------------+-----------+-----------------+-------------------------+----------------------------+-------------+---------------+\n| commit_hash                      | table_name      | committer | email           | date                    | message                    | data_change | schema_change |\n+----------------------------------+-----------------+-----------+-----------------+-------------------------+----------------------------+-------------+---------------+\n| 13qfqa5rojq18j84d1n2htjkm6fletg4 | teams           | Tim Sehn  | tim@dolthub.com | 2022-06-07 16:39:32.066 | Populated tables with data |           1 |             0 |\n| 13qfqa5rojq18j84d1n2htjkm6fletg4 | employees       | Tim Sehn  | tim@dolthub.com | 2022-06-07 16:39:32.066 | Populated tables with data |           1 |             0 |\n| 13qfqa5rojq18j84d1n2htjkm6fletg4 | employees_teams | Tim Sehn  | tim@dolthub.com | 2022-06-07 16:39:32.066 | Populated tables with data |           1 |             0 |\n| ne182jemgrlm8jnjmoubfqsstlfi1s98 | employees       | Tim Sehn  | tim@dolthub.com | 2022-06-07 16:35:49.277 | Created initial schema     |           0 |             1 |\n| ne182jemgrlm8jnjmoubfqsstlfi1s98 | employees_teams | Tim Sehn  | tim@dolthub.com | 2022-06-07 16:35:49.277 | Created initial schema     |           0 |             1 |\n| ne182jemgrlm8jnjmoubfqsstlfi1s98 | teams           | Tim Sehn  | tim@dolthub.com | 2022-06-07 16:35:49.277 | Created initial schema     |           0 |             1 |\n+----------------------------------+-----------------+-----------+-----------------+-------------------------+----------------------------+-------------+---------------+\n6 rows in set (0.00 sec)\n```\n\n## Oh no! I made a mistake.\n\nDolt supports undoing changes via `call dolt_reset()`. Let's imagine I accidentally drop a table.\n\n```\nmysql> drop table employees_teams;\nQuery OK, 0 rows affected (0.01 sec)\n\nmysql> show tables;\n+---------------------------+\n| Tables_in_getting_started |\n+---------------------------+\n| employees                 |\n| teams                     |\n+---------------------------+\n2 rows in set (0.00 sec)\n```\n\nIn a traditional database, this could be disastrous. In Dolt, you're one command away from getting your table back.\n\n```\nmysql> call dolt_reset('--hard');\n+--------+\n| status |\n+--------+\n|      0 |\n+--------+\n1 row in set (0.01 sec)\n\nmysql> show tables;\n+---------------------------+\n| Tables_in_getting_started |\n+---------------------------+\n| employees                 |\n| employees_teams           |\n| teams                     |\n+---------------------------+\n3 rows in set (0.01 sec)\n```\n\nDolt makes operating databases less error prone. You can always back out changes you have in progress or rewind to a known good state. You also have the ability to undo specific commits using [`dolt_revert()`](https:\u002F\u002Fdocs.dolthub.com\u002Fsql-reference\u002Fversion-control\u002Fdolt-sql-procedures#dolt_revert). Even if you accidentally run `drop database` on the wrong database, Dolt lets you undo that by calling the [`dolt_undrop()` stored procedure](https:\u002F\u002Fdocs.dolthub.com\u002Fsql-reference\u002Fversion-control\u002Fdolt-sql-procedures#dolt_undrop).\n\n\n## See the data in a SQL Workbench\n\nHate the command line? Let's use [Tableplus](https:\u002F\u002Ftableplus.com\u002F) to make some modifications. Tableplus is a free SQL Workbench. Follow the installation instructions from their website.\n\nNow, to connect you must select MySQL as the connection type. Then enter a name for your connection, `getting_started` as your database, and `root` as your user.\n\n![Tableplus Connection](.\u002Fimages\u002Fgetting-started-tp-connect.png)\n\nClick connect and you'll be presented with a familiar database workbench GUI.\n\n![Tableplus](.\u002Fimages\u002Fgetting-started-tp.png)\n\n## Make changes on a branch\n\nTo make changes on a branch, I use the `dolt_checkout()` stored procedure. Using the `-b` option creates a branch, just like in Git.\n\nTableplus gives me the ability to enter a multiple line SQL script on the SQL tab. I entered the following SQL to checkout a branch, update, insert, delete, and finally Dolt commit my changes.\n\n```SQL\ncall dolt_checkout('-b','modifications');\nupdate employees SET first_name='Timothy' where first_name='Tim';\ninsert INTO employees (id, first_name, last_name) values (4,'Daylon', 'Wilkins');\ninsert into employees_teams(team_id, employee_id) values (0,4);\ndelete from employees_teams where employee_id=0 and team_id=1;\ncall dolt_commit('-am', 'Modifications on a branch');\n```\n\nHere's the result in Tableplus.\n\n![New Updates](.\u002Fimages\u002Fgetting-started-new-updates.png)\n\nBack in my terminal, I cannot see the table modifications made in Tableplus because they happened on a different branch than the one I have checked out in my session. \n\n```\nmysql> select * from dolt_branches;\n+---------------+----------------------------------+------------------+------------------------+-------------------------+----------------------------+\n| name          | hash                             | latest_committer | latest_committer_email | latest_commit_date      | latest_commit_message      |\n+---------------+----------------------------------+------------------+------------------------+-------------------------+----------------------------+\n| main          | 13qfqa5rojq18j84d1n2htjkm6fletg4 | Tim Sehn         | tim@dolthub.com        | 2022-06-07 16:39:32.066 | Populated tables with data |\n| modifications | uhkv57j4bp2v16vcnmev9lshgkqq8ppb | Tim Sehn         | tim@dolthub.com        | 2022-06-07 16:41:49.847 | Modifications on a branch  |\n+---------------+----------------------------------+------------------+------------------------+-------------------------+----------------------------+\n2 rows in set (0.00 sec)\n\nmysql> select active_branch();\n+-----------------+\n| active_branch() |\n+-----------------+\n| main            |\n+-----------------+\n1 row in set (0.00 sec)\n\nmysql> select * from employees;\n+------+------------+------------+\n| id   | last_name  | first_name |\n+------+------------+------------+\n|    0 | Sehn       | Tim        |\n|    1 | Hendriks   | Brian      |\n|    2 | Son        | Aaron      |\n|    3 | Fitzgerald | Brian      |\n+------+------------+------------+\n4 rows in set (0.00 sec)\n```\n\nI can query the branch no matter what I have checked out using SQL `as of` syntax. \n\n```\nmysql> select * from employees as of 'modifications';\n+------+------------+------------+\n| id   | last_name  | first_name |\n+------+------------+------------+\n|    0 | Sehn       | Timothy    |\n|    1 | Hendriks   | Brian      |\n|    2 | Son        | Aaron      |\n|    3 | Fitzgerald | Brian      |\n|    4 | Wilkins    | Daylon     |\n+------+------------+------------+\n5 rows in set (0.01 sec)\n```\n\nIf I'd like to see the diff between the two branches, I can use the `dolt_diff()` table function. It takes two branches and the table name as arguments.\n\n```\nmysql> select * from dolt_diff('main', 'modifications', 'employees');\n+--------------+---------------+-------+---------------+-------------------------+----------------+-----------------+---------+-------------+-------------------------+-----------+\n| to_last_name | to_first_name | to_id | to_commit     | to_commit_date          | from_last_name | from_first_name | from_id | from_commit | from_commit_date        | diff_type |\n+--------------+---------------+-------+---------------+-------------------------+----------------+-----------------+---------+-------------+-------------------------+-----------+\n| Sehn         | Timothy       |     0 | modifications | 2022-06-07 16:41:49.847 | Sehn           | Tim             |       0 | main        | 2022-06-07 16:39:32.066 | modified  |\n| Wilkins      | Daylon        |     4 | modifications | 2022-06-07 16:41:49.847 | NULL           | NULL            |    NULL | main        | 2022-06-07 16:39:32.066 | added     |\n+--------------+---------------+-------+---------------+-------------------------+----------------+-----------------+---------+-------------+-------------------------+-----------+\n2 rows in set (0.00 sec)\n```\n\nAs you can see, you have the full power of Git-style branches and diffs in a SQL database with Dolt.\n\n## Make a schema change on another branch\n\nI can also make schema changes on branches for isolated testing of new schema. I'm going to add a `start_date` column on a new branch and populate it. \n\n```\nmysql> call dolt_checkout('-b', 'schema_changes');\n+--------+\n| status |\n+--------+\n|      0 |\n+--------+\n1 row in set (0.01 sec)\n\nmysql> alter table employees add column start_date date;\nQuery OK, 0 rows affected (0.02 sec)\n\nmysql> update employees set start_date='2018-09-08';\nQuery OK, 4 rows affected (0.01 sec)\nRows matched: 4  Changed: 4  Warnings: 0\n\nmysql> update employees set start_date='2021-04-19' where last_name='Fitzgerald';\nQuery OK, 1 row affected (0.01 sec)\nRows matched: 1  Changed: 1  Warnings: 0\n\nmysql> select * from employees;\n+------+------------+------------+------------+\n| id   | last_name  | first_name | start_date |\n+------+------------+------------+------------+\n|    0 | Sehn       | Tim        | 2018-09-08 |\n|    1 | Hendriks   | Brian      | 2018-09-08 |\n|    2 | Son        | Aaron      | 2018-09-08 |\n|    3 | Fitzgerald | Brian      | 2021-04-19 |\n+------+------------+------------+------------+\n4 rows in set (0.00 sec)\n\nmysql> call dolt_commit('-am', 'Added start_date column to employees');\n+----------------------------------+\n| hash                             |\n+----------------------------------+\n| pg3nfi0j1dpc5pf1rfgckpmlteaufdrt |\n+----------------------------------+\n1 row in set (0.01 sec)\n```\n\nChanging schema on a branch gives you a new method for doing isolated integration testing of new schema changes.\n\n## Merge it all together\n\nLet's assume all the testing of the new schema on the `schema_changes` branch and data on the `modifications` branch completed flawlessly. It's time to merge all our edits together onto `main`. This is done using the `dolt_merge` stored procedure.\n\n```\nmysql> call dolt_checkout('main');\n+--------+\n| status |\n+--------+\n|      0 |\n+--------+\n1 row in set (0.01 sec)\n\nmysql> select * from dolt_status;\nEmpty set (0.00 sec)\n\nmysql> call dolt_merge('schema_changes');\n+--------------+\n| no_conflicts |\n+--------------+\n|            1 |\n+--------------+\n1 row in set (0.01 sec)\n\nmysql> select * from employees;\n+------+------------+------------+------------+\n| id   | last_name  | first_name | start_date |\n+------+------------+------------+------------+\n|    0 | Sehn       | Tim        | 2018-09-08 |\n|    1 | Hendriks   | Brian      | 2018-09-08 |\n|    2 | Son        | Aaron      | 2018-09-08 |\n|    3 | Fitzgerald | Brian      | 2021-04-19 |\n+------+------------+------------+------------+\n4 rows in set (0.00 sec)\n```\n\nSchema change successful. We now have start dates. Data changes are next.\n\n```\nmysql> call dolt_merge('modifications');\n+--------------+\n| no_conflicts |\n+--------------+\n|            1 |\n+--------------+\n1 row in set (0.02 sec)\n\nmysql> select * from employees;\n+------+------------+------------+------------+\n| id   | last_name  | first_name | start_date |\n+------+------------+------------+------------+\n|    0 | Sehn       | Timothy    | 2018-09-08 |\n|    1 | Hendriks   | Brian      | 2018-09-08 |\n|    2 | Son        | Aaron      | 2018-09-08 |\n|    3 | Fitzgerald | Brian      | 2021-04-19 |\n|    4 | Wilkins    | Daylon     | NULL       |\n+------+------------+------------+------------+\n5 rows in set (0.00 sec)\n```\n\nData changes successful as well. As you can see, I am now \"Timothy\" instead of \"Tim\", Daylon is added, and we all have start dates except for Daylon who was added on a different branch.\n\n```\nmysql> select first_name, last_name, team_name from employees \n    join employees_teams on (employees.id=employees_teams.employee_id) \n    join teams on (teams.id=employees_teams.team_id) \n    where team_name='Sales';\n+------------+------------+-----------+\n| first_name | last_name  | team_name |\n+------------+------------+-----------+\n| Brian      | Fitzgerald | Sales     |\n+------------+------------+-----------+\n1 row in set (0.01 sec)\n```\n\nI'm also gone from the Sales Team. Engineering is life.\n\nI have to commit all my changes because the last merge was not a fast-forward merge.\n\n```\nmysql> call dolt_commit('-m', 'Merged all branches');\n+----------------------------------+\n| hash                             |\n+----------------------------------+\n| vn9b0qcematsj2f6ka0hfoflhr5s6p0b |\n+----------------------------------+\n1 row in set (0.01 sec)\n\nmysql> select * from dolt_log;\n+----------------------------------+-----------+-----------------+-------------------------+--------------------------------------+\n| commit_hash                      | committer | email           | date                    | message                              |\n+----------------------------------+-----------+-----------------+-------------------------+--------------------------------------+\n| vn9b0qcematsj2f6ka0hfoflhr5s6p0b | Tim Sehn  | tim@dolthub.com | 2022-06-07 17:10:02.07  | Merged all branches                  |\n| pg3nfi0j1dpc5pf1rfgckpmlteaufdrt | Tim Sehn  | tim@dolthub.com | 2022-06-07 16:44:37.513 | Added start_date column to employees |\n| uhkv57j4bp2v16vcnmev9lshgkqq8ppb | Tim Sehn  | tim@dolthub.com | 2022-06-07 16:41:49.847 | Modifications on a branch            |\n| 13qfqa5rojq18j84d1n2htjkm6fletg4 | Tim Sehn  | tim@dolthub.com | 2022-06-07 16:39:32.066 | Populated tables with data           |\n| ne182jemgrlm8jnjmoubfqsstlfi1s98 | Tim Sehn  | tim@dolthub.com | 2022-06-07 16:35:49.277 | Created initial schema               |\n| vluuhvd0bn59598utedt77ed9q5okbcb | Tim Sehn  | tim@dolthub.com | 2022-06-07 16:33:59.531 | Initialize data repository           |\n+----------------------------------+-----------+-----------------+-------------------------+--------------------------------------+\n6 rows in set (0.00 sec)\n```\n\nNow, we have a database with all the schema and data changes merged and ready for use.\n\n## Audit Cell Lineage\n\nWhich commit changed my first name? With Dolt you have lineage for every cell in your database. Let's use the `dolt_history_\u003Ctablename>` and `dolt_diff_\u003Ctablename>` to explore the lineage features in Dolt.\n\n`dolt_history_\u003Ctablename>` shows you the state of the row at every commit.\n\n```\nmysql> select * from dolt_history_employees where id=0 order by commit_date;\n+------+-----------+------------+------------+----------------------------------+-----------+-------------------------+\n| id   | last_name | first_name | start_date | commit_hash                      | committer | commit_date             |\n+------+-----------+------------+------------+----------------------------------+-----------+-------------------------+\n|    0 | Sehn      | Tim        | NULL       | 13qfqa5rojq18j84d1n2htjkm6fletg4 | Tim Sehn  | 2022-06-07 16:39:32.066 |\n|    0 | Sehn      | Timothy    | NULL       | uhkv57j4bp2v16vcnmev9lshgkqq8ppb | Tim Sehn  | 2022-06-07 16:41:49.847 |\n|    0 | Sehn      | Tim        | 2018-09-08 | pg3nfi0j1dpc5pf1rfgckpmlteaufdrt | Tim Sehn  | 2022-06-07 16:44:37.513 |\n|    0 | Sehn      | Timothy    | 2018-09-08 | vn9b0qcematsj2f6ka0hfoflhr5s6p0b | Tim Sehn  | 2022-06-07 17:10:02.07  |\n+------+-----------+------------+------------+----------------------------------+-----------+-------------------------+\n4 rows in set (0.00 sec)\n```\n\n`dolt_diff_\u003Ctablename>` allows you to filter the history down to only commits when the cell in question changed. In this case, I'm interested in the commits that are changing my first name. Note, there are two commits that changed my name because one is the original change and the second is the merge commit.\n\n```\nmysql> select to_commit,from_first_name,to_first_name from dolt_diff_employees \n    where (from_id=0 or to_id=0) and (from_first_name \u003C> to_first_name or from_first_name is NULL)\n    order by to_commit_date;\n+----------------------------------+-----------------+---------------+\n| to_commit                        | from_first_name | to_first_name |\n+----------------------------------+-----------------+---------------+\n| 13qfqa5rojq18j84d1n2htjkm6fletg4 | NULL            | Tim           |\n| uhkv57j4bp2v16vcnmev9lshgkqq8ppb | Tim             | Timothy       |\n| vn9b0qcematsj2f6ka0hfoflhr5s6p0b | Tim             | Timothy       |\n+----------------------------------+-----------------+---------------+\n3 rows in set (0.01 sec)\n```\n\nDolt provides powerful data audit capabilities down to individual cells. When, how, and why has each cell in your database changed over time?\n\n# Additional Reading\n\nHead over to [our documentation](https:\u002F\u002Fdocs.dolthub.com\u002Fintroduction\u002Fwhat-is-dolt) now that you have a feel for Dolt. You can also read about what we've been working on in [our blog](https:\u002F\u002Fwww.dolthub.com\u002Fblog\u002F).\n\n# Security Policy\n\n[Dolt's current security policy](https:\u002F\u002Fgithub.com\u002Fdolthub\u002Fdolt\u002Fblob\u002Fmain\u002FSECURITY.md) is maintained in this repository. Please follow the disclosure instructions there. Please do not initially report security issues in this repository's public GitHub issues.\n\n# Credits and License\n\nDolt relies heavily on open source code and ideas from the\n[Noms](https:\u002F\u002Fgithub.com\u002Fattic-labs\u002Fnoms) project. We are very\nthankful to the Noms team for making this code freely available,\nwithout which we would not have been able to build Dolt so rapidly.\n\nDolt is licensed under the Apache License, Version 2.0. See\n[LICENSE](https:\u002F\u002Fgithub.com\u002Fdolthub\u002Fdolt\u002Fblob\u002Fmaster\u002FLICENSE) for\ndetails.\n","Dolt是一个将Git版本控制功能与SQL数据库相结合的工具。它允许用户像操作Git仓库一样对数据进行分支、合并、推送和拉取等操作，同时支持通过标准的MySQL协议连接并操作数据。Dolt的核心技术特点在于其能够为表提供版本控制，并且所有的Git命令都适用于Dolt中的数据管理。此外，Dolt还提供了类似Git的命令行界面来导入CSV文件、提交更改或同步远程库。该工具非常适合需要对数据集进行版本控制的应用场景，如协作开发环境下的数据共享、AI代理的记忆存储解决方案以及多机器或多代理工作流中的一致性维护等。",2,"2026-06-11 03:00:26","top_language"]