Connect DuckDB / MotherDuck
Connect persistent MotherDuck data through Querio's DuckDB option, then check table access and discovery limits.
To query persistent MotherDuck data in Querio, choose DuckDB and enter a MotherDuck md: connection string. Prepare a token with access to the data you need, then test the connection and a known result.
You'll need permission to manage datasources in Querio, a MotherDuck database name, and an approved table and result to check. For the shared Querio connection and access steps, see Connect a datasource.
1. Prepare the MotherDuck token and access
Use a dedicated MotherDuck service account for a shared connection. In MotherDuck, go to Settings > Service Accounts, create an account, open its details, and select Create token. Name the token, set an expiration if required by your policy, and store its value securely. MotherDuck shows it only once. You need permission to create the account and token; MotherDuck's Admin and Builder roles include those permissions by default. See Create and configure service accounts.
For read-only analysis, configure the account's read scaling pool and choose a Read Scaling Token. It permits reads but restricts writes and database administration. Use a Read/Write Token only when the connection needs those broader capabilities. Querio has no separate read-only switch for this connection.
The token uses the service account's data access. Have the data owner grant access to the intended MotherDuck Shares and attach the required databases or Shares as that account. A platform role alone does not grant access to every Share. Read Scaling Tokens cannot change attachments, so prepare them with a read/write token or by impersonating the service account. Check that the account can run your approved query before continuing. See MotherDuck roles and data access.
Read scaling replicas can lag changes by a few minutes. Keep that in mind when comparing recent rows. See MotherDuck read scaling.
2. Enter the md: connection string in Querio
Open Settings > Datasources > Add datasource and choose Internal. Enter:
| Field | Value |
|---|---|
| Slug | A unique identifier, such as motherduck-analytics. |
| Name | An optional display name, such as Analytics warehouse. |
| Database type | DuckDB. |
| Connection string | The native MotherDuck string below. |
Replace analytics with your database name and YOUR_MOTHERDUCK_TOKEN with the token value:
md:analytics?motherduck_token=YOUR_MOTHERDUCK_TOKENQuerio passes this string to its native DuckDB driver. Use the md: format, not a JDBC or PostgreSQL URL. There is no separate token field or environment-variable substitution in this form. Treat the whole string as a secret: the field is not a masked password input. Enter it in the connection form, never in a prompt, screenshot, source file, or support message.
3. Test and query
- Select Test connection. Expect Connection successful, then select Create. Querio tests again before saving.
- Confirm the datasource appears in Settings > Datasources. Follow Connect a datasource to review credential assignments and add the tables needed for your question.
- As the intended Querio user, open an Explore with this datasource selected and run:
SELECT 6 * 7 AS answer;Expect one row with answer = 42. The connection test checks connectivity; this query checks execution for that user. Querying requires datasource permission and exactly one authorized credential. Groups explains access errors.
Then check a known business result. Replace the identifiers and test value below with a table and row the service account can read:
SELECT order_id, order_total
FROM analytics.main.orders
WHERE order_id = 'known-test-order';Compare the result with the same query under the service-account identity in MotherDuck. Check the database, filters, and replica freshness if the results differ. A successful connection test does not prove table access or data correctness.
4. Check attached-database discovery
MotherDuck normally attaches the service account's saved workspace, even when the connection string names one database. Querio's discovery does not reliably separate identically named schemas and tables across attached databases; imported column metadata can be mixed. Inspect the tables and columns added to Context before relying on them. If the account uses multiple attached databases with overlapping names, confirm that layout with Querio. See MotherDuck connection parameters.
5. Other DuckDB uses
For a temporary SQL check, choose DuckDB and enter :memory: as the Connection string. The arithmetic query above returns 42. Each fresh in-memory connection starts empty; saving the datasource does not persist tables created there. See DuckDB's Python connection behavior.
Local .duckdb file paths, including duckdb:///path/to/data.duckdb, are rejected. To analyze uploaded files, use Upload files for analysis.
If the connection fails
| Symptom | Check |
|---|---|
| Token rejected or expired | Check the service account, token value, expiration, and revocation state. Replace the saved connection with a new token when rotating it. |
| Database or Share missing | Check the account's grants and saved attachments. Prepare attachments before using a Read Scaling Token. |
| Connection or extension error | Check the complete md: string and ask Querio to check deployment connectivity and compatible extension loading. Browser access to MotherDuck alone does not establish either. |
| Recent rows absent | Compare identity, database, filters, and read scaling replica freshness with the trusted result. |
Once the result matches, analyze your data and add context for the questions your team will ask next.
Last updated on November 18, 2026