Retool
Low-code platform for building internal tools and custom business applications with drag-and-drop UI components.
There are two ways to connect Retool to MotherDuck, depending on whether you use Retool Cloud or self-hosted Retool.
Retool Cloud (native connector)
Retool Cloud has a native MotherDuck resource type. To connect:
- Go to Resources and select Create new > Resource.
- Search for MotherDuck and select it.
- Give the resource a descriptive name (for example, "MotherDuck analytics").
- Under Resource credentials, enter your MotherDuck access token.
- Optionally enter a Database name. Leave it empty to use workspace mode, which lets you query across multiple databases.
- Click Test connection, then Create resource.
You can use this resource in your Retool apps to run SQL queries against your MotherDuck databases. The resource supports both SQL mode for reading data and GUI mode for write operations (insert, update, delete, upsert).
Connection options
You can pass optional key-value pairs under Connection options to customize behavior:
| Option | Values | Description |
|---|---|---|
access_mode | READ_WRITE, READ_ONLY | Controls whether the connection can write data |
attach_mode | single, workspace | Sets the attach mode. single scopes the connection to one database (useful when querying a specific tenant or to avoid catalog clutter); workspace (default) attaches every database in your saved workspace. |
TimeZone | For example, UTC, America/New_York | Sets the session time zone |
default_null_order | NULLS_FIRST, NULLS_LAST | Default null ordering for queries |
default_order | ASC, DESC | Default sort order for queries |
For more details, see the Retool MotherDuck documentation.
Known limitations
BLOBandARRAYcolumn types are not supported by the native connector. Queries that return these types will fail. Cast these columns to a supported type (for example, usingCASTorlist_string_agg) or exclude them from your result set.
Self-hosted (JDBC)
If you run a self-hosted Retool instance, you can connect to MotherDuck through the DuckDB JDBC driver. Your instance needs network access to motherduck.com over HTTPS (port 443).
-
In your Retool instance, go to Resources and select Create new.
-
Choose JDBC as the resource type.
-
Use the following JDBC connection string:
jdbc:duckdb:md:<database_name>?motherduck_token=<your_token>Replace
<database_name>with your MotherDuck database and<your_token>with your access token. -
Test the connection and save.
For more details on the JDBC driver, see JDBC driver.