Skip to content

Commit fc63ad1

Browse files
authored
docs(duckdb): add docs for MotherDuck source (#520)
1 parent eea6f87 commit fc63ad1

File tree

1 file changed

+56
-4
lines changed

1 file changed

+56
-4
lines changed

docs/catalog/duckdb.md

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -506,12 +506,59 @@ A `create server` statement example used to access local Iceberg service:
506506
);
507507
```
508508

509+
#### MotherDuck
510+
511+
This is to access [MotherDuck](https://motherduck.com/), a cloud-hosted DuckDB service.
512+
513+
| Server Option | Description | Required | Default |
514+
| ------------- | ----------- | :------: | ------- |
515+
| type | Server type, must be `md` | Y | |
516+
| database | The MotherDuck database name to use | Y | |
517+
| motherduck_token | The MotherDuck access token | Y | |
518+
519+
!!! info
520+
To obtain a MotherDuck access token, visit [https://app.motherduck.com/settings/tokens](https://app.motherduck.com/settings/tokens) in your browser and create a new token.
521+
522+
A `create server` statement example:
523+
524+
=== "With Vault"
525+
526+
```sql
527+
create server duckdb_server
528+
foreign data wrapper duckdb_wrapper
529+
options (
530+
type 'md',
531+
532+
-- The database name
533+
database 'my_db',
534+
535+
-- The MotherDuck token saved in Vault
536+
vault_motherduck_token '<token>'
537+
);
538+
```
539+
540+
=== "Without Vault"
541+
542+
```sql
543+
create server duckdb_server
544+
foreign data wrapper duckdb_wrapper
545+
options (
546+
type 'md',
547+
548+
-- The database name
549+
database 'my_db',
550+
551+
-- The MotherDuck access token
552+
motherduck_token '<token>'
553+
);
554+
```
555+
509556
### Create a schema
510557

511558
We recommend creating a schema to hold all the foreign tables:
512559

513560
```sql
514-
create schema if not exists iceberg;
561+
create schema if not exists duckdb;
515562
```
516563

517564
## Options
@@ -558,11 +605,16 @@ import foreign schema "docs_example"
558605
from server duckdb_server into duckdb;
559606
```
560607

561-
Currently only Iceberg-like servers, such as S3 Tables, R2 Data Catalog and etc., support `import foreign schema` without specifying source tables. For other types of servers, source tables must be explicitly specified in options. For example,
608+
Currently only MotherDuck and Iceberg-like servers, such as S3 Tables, R2 Data Catalog and etc., support `import foreign schema` without specifying source tables. For other types of servers, source tables must be explicitly specified in options. For example,
562609

563610
```sql
564-
-- 'duckdb_server_s3_tables' server type is 's3_tables', so all tables
565-
-- under 'docs_example' namespace can be imported automatically
611+
-- 'duckdb_server_md' server type is 'md', all tables under 'main' schema
612+
-- will be imported from MotherDuck automatically
613+
import foreign schema "main"
614+
from server duckdb_server_md into duckdb;
615+
616+
-- 'duckdb_server_s3_tables' server type is 's3_tables', all tables
617+
-- under 'docs_example' namespace will be imported automatically
566618
import foreign schema "docs_example"
567619
from server duckdb_server_s3_tables into duckdb;
568620

0 commit comments

Comments
 (0)