dolthub / go-mysql-server

A MySQL-compatible relational database with a storage agnostic query engine. Implemented in pure Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: persistent database store

jonahzheng opened this issue · comments

go-mysql-server, how to save data to hard disk?

Hi @jonahzheng,

There is no persistent database implementation built into the package. The provided memory implementation only persists in memory for a single process's lifetime. You would need to implement a persistent version to get this functionality.

We would take this contribution as a patch if you wanted to write it. A first attempt would probably extend the memory.Database and serialize table schemas as CREATE TABLE statements, and table data as CSV or JSON. Happy to provide additional pointers if you or someone else want to attempt this.

Alternately, you could build on top of Dolt, which is MySQL compatible and uses go-mysql-server as its query layer. Then you get persistence for free.

https://github.com/dolthub/dolt

Depending on what you're trying to do, the driver package might be a more convenient way to build on top of Dolt:

https://github.com/dolthub/driver