Installation
Install the MotherDuck connector:Configuration
Configuration Parameters
MotherDuck API token (service token or personal access token)
Specific database to connect to. If not specified, connects to your default database
Getting a MotherDuck Token
- Sign up at motherduck.com
- Navigate to Settings → Access Tokens
- Create a new service token or personal access token
- Copy the token and add it to your
.envfile
Features
MotherDuck uses the DuckDB connector under the hood, providing access to all DuckDB functionality plus cloud features.Type Mapping
Same as DuckDB:- Numbers: TINYINT, SMALLINT, INTEGER, BIGINT, HUGEINT, FLOAT, DOUBLE, DECIMAL
- Strings: VARCHAR, STRING, TEXT, TIME
- Dates: DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE
- Booleans: BOOLEAN
Cloud Storage Integration
MotherDuck can read from cloud storage with automatic credential management:queries/s3_data.sql
Hybrid Execution
MotherDuck automatically decides whether to execute queries in the cloud or locally for optimal performance.Sharing and Collaboration
Share databases across your organization:queries/shared_data.sql
Example Queries
Query Cloud Data
queries/cloud_analytics.sql
Combine Local and Cloud Data
queries/hybrid_query.sql
Use DuckDB Extensions
queries/with_extensions.sql
Database Management
Create a Database
List Databases
Switch Database
Specify the database in your connection configuration or use:Performance Optimization
Partitioned Data
Organize cloud data by partitions:Materialized Views
Create materialized views for frequently accessed aggregations:Result Caching
MotherDuck automatically caches query results for faster repeated queries.Version Compatibility
MotherDuck connections require MotherDuck version 0.10.0 or later. If you experience connection issues, verify your MotherDuck instance version.
Troubleshooting
Connection timeout
Connection timeout
MotherDuck connections may take a few seconds on first connect while the cloud instance warms up. Subsequent connections should be faster.If connections consistently timeout:
- Verify your MotherDuck token is valid
- Check your internet connection
- Ensure you’re using MotherDuck >= 0.10.0
Invalid token errors
Invalid token errors
- Verify the token is copied correctly (no extra spaces)
- Ensure the token hasn’t expired
- Create a new service token if needed
Database not found
Database not found
- Check the database name is spelled correctly
- Verify you have access to the database
- Try connecting without specifying a database to see available databases
Slow query performance
Slow query performance
- Check if data can be partitioned for faster filtering
- Consider creating materialized views for complex aggregations
- Use columnar formats (Parquet) instead of CSV for better performance
Migrating from Local DuckDB
To migrate from local DuckDB to MotherDuck:-
Export your local data:
- Update your connection configuration to use MotherDuck
-
Import data in MotherDuck: