Connect to MotherDuck
Connect MotherDuck to Retool and query analytics data, build dashboards, and manage records with DuckDB SQL.
MotherDuck is a cloud-based analytics database built on DuckDB, an in-process OLAP database optimized for analytical queries. It provides serverless cloud storage for DuckDB databases with multi-user collaboration and instant scalability.
What you can do with MotherDuck in Retool
- Query with SQL: Write analytical queries using the DuckDB SQL dialect, including aggregations, window functions, and built-in support for reading Parquet, CSV, and JSON files.
- Build dashboards: Power charts, tables, and reports with fast columnar queries across large datasets.
- Query across databases: Use workspace mode to query multiple MotherDuck databases in a single SQL statement.
- Manage data: Insert, update, and delete records using GUI mode for write operations.
Before you begin
To connect MotherDuck to Retool, you need the following:
- Cloud instances
- Self-hosted instances
- MotherDuck account: A MotherDuck account with one or more databases.
- MotherDuck access token: A personal access token from your MotherDuck account settings.
- Retool permissions: The ability to create and manage resources.
- MotherDuck account: A MotherDuck account with one or more databases.
- MotherDuck access token: A personal access token from your MotherDuck account settings.
- Network access: Your Retool instance must be able to reach
motherduck.comover HTTPS (port 443). - Retool permissions: Own permissions for resources in your organization.
To generate an access token, log in to app.motherduck.com, navigate to Settings → Access Tokens, and create a new token.
Create a MotherDuck resource
Follow these steps to create a MotherDuck resource in your Retool organization.
1. Create a new resource
Navigate to Resources in the main navigation and click Create new → Resource. Search for MotherDuck and click the MotherDuck tile to begin configuration.
Use folders to organize your resources by team, environment, or data source type. This helps keep your resource list manageable as your organization grows.
2. Configure general settings
Specify a name and description for the resource that indicates which database or workspace it connects to. The description provides more context to users about how to use the resource.
| Example name | Example description |
|---|---|
MotherDuck analytics | MotherDuck workspace with sales and product analytics data. |
MotherDuck orders (readonly) | Read-only MotherDuck database containing order history. |
3. Configure resource credentials
Configure the connection settings for your MotherDuck resource.

MotherDuck resource configuration form.
Access token
Your MotherDuck personal access token authenticates all queries made through this resource. Retool encrypts and stores the token securely.
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Database name
Enter the name of the MotherDuck database to connect to. If left empty, the resource connects in workspace mode, which allows queries across all of your MotherDuck databases.
my_analytics_db
sales_data
Leave Database name empty to enable workspace mode. In workspace mode, reference tables using fully qualified names: FROM my_db.main.orders.
Connection options
Add optional key-value pairs to customize the MotherDuck connection. Only the following options are accepted:
| Option | Description | Example values |
|---|---|---|
access_mode | Sets the connection access mode. | READ_WRITE, READ_ONLY |
attach_mode | Controls how MotherDuck attaches databases. | single, default |
TimeZone | Sets the session time zone. | America/New_York, UTC |
default_null_order | Controls sort order of NULL values. | NULLS_FIRST, NULLS_LAST |
default_order | Sets the default sort direction. | ASC, DESC |
http_timeout | HTTP request timeout in seconds. | 30, 60 |
4. Configure advanced options
Configure optional settings available under the Advanced options section.
Outbound region
- Cloud instances
- Self-hosted instances
If your organization uses outbound regions, select the region that should be used for requests to MotherDuck. This controls which geographic region your requests originate from.
Self-hosted instances do not have the outbound region field.
Disable converting queries to prepared statements
When enabled, Retool sends queries without using prepared statements. Enable this option if you encounter compatibility issues with certain DuckDB SQL constructs that do not support parameterized queries.
5. Test the connection
Click Test connection to verify Retool can connect to MotherDuck. If the test succeeds, you see a success message. If it fails, check the following:
- Access token: Confirm the token is valid and has not expired. Generate a new token in MotherDuck settings if needed.
- Database name: If you specified a database name, confirm the database exists in your MotherDuck account. Leave the field empty to use workspace mode.
- Network access: For self-hosted instances, confirm your Retool server can reach
motherduck.comover HTTPS.
After testing the connection, click View in console to open the Debug Tools console. The console displays detailed information about the test, including the test query executed and its response, execution time, and any error details.