You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| 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
+
509
556
### Create a schema
510
557
511
558
We recommend creating a schema to hold all the foreign tables:
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,
562
609
563
610
```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
0 commit comments