From 995459e668e48f53681eaa21b676f8cd4d1ee4d1 Mon Sep 17 00:00:00 2001 From: TianyuZhang1214 Date: Mon, 30 Dec 2024 18:33:23 +0800 Subject: [PATCH] doc: managing multiple databases (#327) --- README.md | 10 ++++-- docs/tutorial/manage-multiple-databases.md | 40 ++++++++++++++++++++++ logo/MyDuck.svg | 2 +- 3 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 docs/tutorial/manage-multiple-databases.md diff --git a/README.md b/README.md index beee1863..e034401e 100644 --- a/README.md +++ b/README.md @@ -201,9 +201,13 @@ Looking to load Parquet files into MyDuck Server and start querying? Follow our Already have a DuckDB file? You can seamlessly bootstrap MyDuck Server with it. See our [DuckDB file bootstrapping guide](docs/tutorial/bootstrap.md) for more details. +### Managing Multiple Databases + +Easily manage multiple databases in MyDuck Server, same as Postgres. For step-by-step instructions and detailed guidance, check out our [Database Management Guide](docs/tutorial/manage-multiple-databases.md). + ### Backup and Restore with Object Storage -To back up and restore your MyDuck Server database using object storage, refer to our [backup and restore guide](docs/tutorial/backup-restore.md) for detailed instructions. +To back up and restore your databases inside MyDuck Server using object storage, refer to our [backup and restore guide](docs/tutorial/backup-restore.md) for detailed instructions. ### LLM Integration @@ -217,8 +221,8 @@ MyDuck Server can be seamlessly accessed from the Python data science ecosystem. We have big plans for MyDuck Server! Here are some of the features we’re working on: -- [ ] Arrow Flight SQL. -- [ ] Multiple DB. +- [x] Arrow Flight SQL. +- [x] Multiple DB. - [ ] Authentication. - [ ] ...and more! We’re always looking for ways to make MyDuck Server better. If you have a feature request, please let us know by [opening an issue](https://github.com/apecloud/myduckserver/issues/new). diff --git a/docs/tutorial/manage-multiple-databases.md b/docs/tutorial/manage-multiple-databases.md new file mode 100644 index 00000000..24d6e8b1 --- /dev/null +++ b/docs/tutorial/manage-multiple-databases.md @@ -0,0 +1,40 @@ +### Managing Databases in MyDuck Server + +MyDuck Server offers basic database operations similar to PostgreSQL. Each database in MyDuck Server is represented as a single DuckDB data file. As a result, all database operations are mapped to corresponding file operations. Below are the key commands for managing databases in MyDuck Server: + +#### 1. `CREATE DATABASE` +The `CREATE DATABASE db_name` command creates a new database by generating a file named `db_name.db`. This database is then attached to the current DuckDB client session. + +**Example:** +```sql +CREATE DATABASE my_database; +``` + +This will create a new database file `my_database.db` and attach it to the current session. + +#### 2. `DROP DATABASE` +The `DROP DATABASE db_name` command detaches the specified database from the current session and deletes the associated database file (`db_name.db`). + +**Example:** +```sql +DROP DATABASE my_database; +``` + +This will detach `my_database` from the current session and permanently delete the file `my_database.db` from storage. + +#### 3. `USE DATABASE` +The `USE db_name` command allows you to switch the current session to a different database. After executing this command, all subsequent operations will be performed on the specified database. + +**Example:** +```sql +USE my_database; +``` + +This command switches the current session to the `my_database` database, and all further queries will be executed on it. + +--- + +### Important Notes + +- This feature is available only through the PostgreSQL protocol. +- To backup your database to object storage or restore it from a backup file, please refer to the [Backup and Restore Guide](./backup-restore.md). \ No newline at end of file diff --git a/logo/MyDuck.svg b/logo/MyDuck.svg index b164127b..4761166e 100644 --- a/logo/MyDuck.svg +++ b/logo/MyDuck.svg @@ -1 +1 @@ -Object StorageLocal DiskDuckDBformatZero-ETL Data SyncTransactionalReadReadWriteWrite(Planned)Query EngineDatabaseProxyBackupRestoreDuckDBformatMyDuckServer Columnar IOE2EDelta LakeParquetProtocol MySQL PostgreSQLProtocolDashboard,BI,DataApps,LLMs,ETLTools,PythonLibraries,DataframeAPIs,Embedded DuckDB \ No newline at end of file +Object StorageLocal DiskZero-ETL Data SyncTransactionalReadReadWriteWrite(Planned)Query EngineDatabaseProxyBackupRestoreDuckDBformatMyDuckServer Columnar IOE2EDelta LakeParquetProtocol MySQL PostgreSQLProtocolDashboard,BI,DataApps,LLMs,ETLTools,PythonLibraries,DataframeAPIs,Embedded DuckDBDuckDBformat \ No newline at end of file