Skip to content

Commit 07b85ae

Browse files
committed
docs: add MotherDuck CLI connection documentation
Documents how to connect to MotherDuck using the CLI via the create-duckdb command with --database-path and --mother-duck-token options. Aligns with malloy-cli PR #124.
1 parent 794b048 commit 07b85ae

1 file changed

Lines changed: 40 additions & 2 deletions

File tree

src/documentation/setup/cli.malloynb

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ malloy-cli --help
2828

2929
The CLI stores its own configuration separately from VS Code in `~/.config/malloy/config.json`.
3030

31-
**Note:** The CLI does not support environment variables for connection configuration. Use the CLI commands below to manage connections.
31+
**Note:** The CLI does not support environment variables for connection configuration (except for MotherDuck, which can use `MOTHERDUCK_TOKEN`). Use the CLI commands below to manage connections.
3232

3333
### Connection Commands
3434

@@ -58,7 +58,7 @@ malloy-cli connections create-bigquery <connection-name>
5858
# For Postgres
5959
malloy-cli connections create-postgres <connection-name>
6060

61-
# For DuckDB
61+
# For DuckDB (or MotherDuck)
6262
malloy-cli connections create-duckdb <connection-name>
6363
```
6464

@@ -78,6 +78,13 @@ malloy-cli connections create-bigquery --help
7878
-m, --maximum-bytes-billed <bytes> Limit bytes scanned
7979
```
8080

81+
**DuckDB options:**
82+
83+
```
84+
--database-path <database> Path to DuckDB database file or MotherDuck database (e.g., "md:my_database")
85+
--mother-duck-token <token> MotherDuck API token (can also use MOTHERDUCK_TOKEN env var)
86+
```
87+
8188
### Default Connections
8289

8390
Two connections are created automatically:
@@ -96,6 +103,37 @@ gcloud auth login --update-adc
96103
malloy-cli connections create-bigquery my-bq
97104
```
98105

106+
### MotherDuck
107+
108+
MotherDuck connections use the `create-duckdb` command with special options. To connect to MotherDuck, you'll need an access token:
109+
110+
1. Log in to MotherDuck and go to **Settings**
111+
2. Create and copy your access token
112+
3. Create the connection using `create-duckdb` with `--database-path` set to `md:` followed by your database name:
113+
114+
**Using environment variable (recommended):**
115+
116+
```bash
117+
export MOTHERDUCK_TOKEN="your_token_here"
118+
malloy-cli connections create-duckdb my-md --database-path "md:my_database"
119+
```
120+
121+
**Using command-line flag:**
122+
123+
```bash
124+
malloy-cli connections create-duckdb my-md \
125+
--database-path "md:my_database" \
126+
--mother-duck-token "your_token_here"
127+
```
128+
129+
If you don't specify a database name, use `md:`:
130+
131+
```bash
132+
malloy-cli connections create-duckdb my-md \
133+
--database-path "md:" \
134+
--mother-duck-token "your_token_here"
135+
```
136+
99137
---
100138

101139
## Basic Commands

0 commit comments

Comments
 (0)