dolt icon indicating copy to clipboard operation
dolt copied to clipboard

`dolt sql` and other commands should connect to running database

Open zachmu opened this issue 1 year ago • 2 comments

It's not safe to issue CLI commands to update a database while a server is running. To prevent issues this might cause, we made any command that updates database state fail if a server is running. This makes the command line much less useful.

Instead of locking the database when a server is running, we should implement the following:

  1. Implement all dolt CLI commands as SQL commands
  2. Make dolt automatically connect to appropriate running server to issue its command
  3. If no server is running, the command behaves exactly as if the command started a server, issued the single command, and quit the server.
  4. The command line client is a single long-term session that persists between database invocations

This design necessarily also resolves odd differences in behavior between running a command and issuing its equivalent SQL statement.

We can make this change incrementally, but we shouldn't write new commands or make major changes to existing ones without considering this design.

zachmu avatar Jul 25 '22 21:07 zachmu

Makes sense to me. I love unifying on the sql path and cleaning up the duplicated logic in the CLI commands.

The only downside I could brainstorm was that starting a server will slow down some of the CLI commands, but that seems negligible for a command line experience.

fulghum avatar Jul 26 '22 00:07 fulghum

As you can see, this is heavily in progress.

timsehn avatar Sep 25 '23 22:09 timsehn

Resoving this uber issue as we have sub issues for the commands that don't now.

timsehn avatar Apr 15 '24 23:04 timsehn