horaedb icon indicating copy to clipboard operation
horaedb copied to clipboard

Support create/drop database

Open jiacai2050 opened this issue 2 years ago • 2 comments

Describe This Problem

In current implementation, there is only one database(called schema in src), we should support database creation to allow one server holding multiple databases.

Proposal

Support those SQL

create database NAME;
drop database NAME;

As for distributed deployment, ceresmeta need to distribute newly-created database to all servers.

Additional Context

For distributed mode, the default database is created when server start up, it should first communicate with ceresmeta to check whether this database is already existing.

https://github.com/CeresDB/ceresmeta/issues/136

jiacai2050 avatar Jan 31 '23 03:01 jiacai2050

Hi, is it done? any documentation for it? how to implement it?

//->#go-sdk

client, err := ceresdb.NewClient(endpoint, ceresdb.Direct)

if err != nil {
  return err
}

resp, err := client.SQLQuery(context.Background(), ceresdb.SQLQueryRequest{
  Tables: []string{},
  SQL:    "create database NAME;",
})

is it correct? i got this error with those script:

err: add request ctx: no database selected, you can use database in client initial options or WriteRequest/SqlQueryRequest

jackbit avatar Nov 24 '23 13:11 jackbit

Hi, this feature hasn't got implemented yet.

jiacai2050 avatar Nov 24 '23 15:11 jiacai2050