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
Two connections are created automatically if you don't already have a connection that overrides them — `bigquery` and `duckdb`. If your Malloy files reference these connection names, they work without explicit setup. DuckDB uses a built-in in-memory instance, and BigQuery attempts to connect using any existing gcloud authentication on your computer.
85
+
82
86
### DuckDB Working Directory
83
87
84
88
When a DuckDB connection does not have `workingDirectory` set in the config, the CLI automatically resolves relative table paths (like `duckdb.table('data.csv')`) relative to the `.malloy` or `.malloysql` file being run. If you set `workingDirectory` explicitly, that value is used instead.
Snowflake also supports TOML configuration at `~/.snowflake/connections.toml`. See [Snowflake connection configuration](https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-connect#connecting-using-the-connections-toml-file) for details.
@@ -131,85 +145,28 @@ SET search_path TO analytics; CREATE TEMP TABLE foo AS SELECT 1;
131
145
132
146
---
133
147
134
-
## Environment Variables
135
-
136
-
Some databases support configuration via environment variables. When environment variables are set, a connection is created automatically using those values. Values set in `malloy-config.json` override environment variables.
137
-
138
-
### MotherDuck
139
-
140
-
MotherDuck is configured through a token. In MotherDuck, click **Settings** then copy your token.
141
-
142
-
```bash
143
-
export MOTHERDUCK_TOKEN=your_token_here
144
-
```
145
-
146
-
The default connection name for MotherDuck is `md`.
147
-
148
-
**Example usage:**
149
-
```malloy
150
-
source: hacker_news is md.table('sample_data.hn.hacker_news')
151
-
```
152
-
153
-
### MySQL
154
-
155
-
MySQL connections can be configured entirely through environment variables.
156
-
157
-
```bash
158
-
export MYSQL_USER=readonly
159
-
export MYSQL_HOST=db.example.com
160
-
export MYSQL_PORT=3306
161
-
export MYSQL_PASSWORD=your_password
162
-
export MYSQL_DATABASE=analytics
163
-
```
164
-
165
-
The default connection name is `mysql`. `MYSQL_USER` is required; other variables are optional but typically needed.
Snowflake also supports TOML configuration at `~/.snowflake/connections.toml`. See [Snowflake connection configuration](https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-connect#connecting-using-the-connections-toml-file) for details.
Fields with type `password` or `secret` contain sensitive values like credentials and API tokens. Instead of putting these directly in your config file, you can use an environment variable reference:
193
151
194
-
```bash
195
-
export PRESTO_HOST=presto.example.com # Required
196
-
export PRESTO_PORT=8080 # Defaults to 8080
197
-
export PRESTO_USER=analyst
198
-
export PRESTO_PASSWORD=your_password
199
-
export PRESTO_CATALOG=hive
200
-
export PRESTO_SCHEMA=default
152
+
```json
153
+
{
154
+
"connections": {
155
+
"my_motherduck": {
156
+
"is": "duckdb",
157
+
"databasePath": "md:my_database",
158
+
"motherDuckToken": {"env": "MOTHERDUCK_TOKEN"}
159
+
},
160
+
"my_postgres": {
161
+
"is": "postgres",
162
+
"host": "db.example.com",
163
+
"password": {"env": "PG_PASSWORD"}
164
+
}
165
+
}
166
+
}
201
167
```
202
168
203
-
The default connection name is `presto`.
204
-
205
-
### Databases Without Environment Variable Support
206
-
207
-
- **BigQuery**: Uses `gcloud auth login --update-adc` (OAuth) or a service account key file configured in `malloy-config.json`
208
-
- **PostgreSQL**: Uses connection parameters in `malloy-config.json` (credentials stored in system keychain for VS Code)
209
-
- **DuckDB**: Uses file paths directly, no authentication needed
210
-
211
-
---
169
+
The `{"env": "VAR_NAME"}` syntax looks up the value from the named environment variable at connection time. If the variable is not set, the field is omitted and the connection proceeds without it.
212
170
213
-
## Default Connections
171
+
You can also provide a plain string value directly — this is useful for testing but not recommended for shared or committed config files.
214
172
215
-
Two connections are created automatically if you don't already have a connection that overrides them — `bigquery` and `duckdb`. If your Malloy files reference these connection names, they work without explicit setup. DuckDB uses a built-in in-memory instance, and BigQuery attempts to connect using any existing gcloud authentication on your computer.
Copy file name to clipboardExpand all lines: src/documentation/setup/extension.malloynb
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -139,7 +139,7 @@ Add a PostgreSQL connection via **Malloy: Edit Connections**. Enter host, port,
139
139
140
140
### MySQL
141
141
142
-
MySQL connections require environment variables — see [Configuration](config.malloynb#mysql). The extension will detect the connection automatically when the variables are set.
142
+
MySQL connections can be configured in `malloy-config.json` or via environment variables — see [Configuration](config.malloynb).
0 commit comments