Skip to main content
Version: 0.4 (Latest)

MotherDuck Reference

Reference material for MotherDuck Publishing -- data type mappings, CLI arguments, querying, and troubleshooting.

Data Type Mapping​

Source types map automatically to DuckDB/MotherDuck-compatible types. LakeXpress exports through Parquet, so the mapping is driven by the normalized source type name.

Pick your source database:

PostgreSQL to DuckDB/MotherDuck​

PostgreSQL TypeDuckDB/MotherDuck Type
SMALLINTSMALLINT
INTEGER, INT4INTEGER
BIGINT, INT8BIGINT
NUMERIC(p,s)DECIMAL(p,s)
REAL, FLOAT4REAL
DOUBLE PRECISION, FLOAT8DOUBLE
VARCHAR(n), TEXT, CHAR(n), array []VARCHAR
BOOLEANBOOLEAN
DATEDATE
TIMETIME
TIMESTAMPTIMESTAMP
TIMESTAMPTZTIMESTAMPTZ
BYTEABLOB
UUIDUUID
JSON, JSONBJSON

CLI Reference​

MotherDuck Publishing Arguments​

OptionTypeDescription
--publish_target IDStringCredential ID for MotherDuck publishing (required)
--publish_schema_pattern PATTERNStringDynamic schema naming pattern (default: {schema} for internal, EXT_{schema} for the default external method)
--publish_table_pattern PATTERNStringDynamic table naming pattern (default: {table})
--publish_method TYPEStringTable type: external (default) or internal
--pk_constraintsFlagAdd PRIMARY KEY constraints to native (internal) table DDL; not supported for external views
--n_jobs NIntegerNumber of parallel workers for table creation (default: 1)

Querying MotherDuck Tables​

Once published, query tables via any of these methods.

MotherDuck Web UI:

Log in to app.motherduck.com and run:

SELECT * FROM my_analytics.lx_tpch_1.customer LIMIT 10;

DuckDB CLI:

duckdb "md:my_analytics?motherduck_token=your_token"
SELECT * FROM lx_tpch_1.customer LIMIT 10;

Python (duckdb):

import duckdb

conn = duckdb.connect("md:my_analytics?motherduck_token=your_token")
df = conn.execute("SELECT * FROM lx_tpch_1.customer LIMIT 10").df()
print(df)

Python with environment variable:

import os
import duckdb

os.environ["motherduck_token"] = "your_token"
conn = duckdb.connect("md:my_analytics")
df = conn.execute("SELECT * FROM lx_tpch_1.customer LIMIT 10").df()
print(df)

Troubleshooting​

Common Issues​

"Authentication failed":

  • Verify your token is valid and not expired
  • Check token permissions for the target database
  • For env mode, ensure motherduck_token is set

"Database not found":

  • Verify the database name matches an existing MotherDuck database
  • Create the database in MotherDuck UI before publishing

"IO Error: No files found that match the pattern" or "Permission error: Missing or invalid credentials":

  • LakeXpress auto-configures a lakexpress_storage secret from the --target_storage_id credential on every publish, so this usually means that credential itself is misconfigured (wrong keys, an unresolvable profile, etc.)
  • If querying published views outside of a LakeXpress run, create a secret in MotherDuck manually with your cloud storage credentials (see Storage Access)
  • Verify secrets are configured: SELECT * FROM duckdb_secrets();
  • Test access: SELECT count(*) FROM read_parquet('s3://your-bucket/path/*.parquet');

"Cannot read file" (external views):

  • Verify cloud storage credentials in MotherDuck
  • Check that the S3/GCS/Azure path contains valid Parquet files
  • Ensure the bucket allows access from MotherDuck
  • Verify the files exist: aws s3 ls s3://your-bucket/path/ --recursive | head

"Connection timeout":

  • Check network connectivity
  • MotherDuck requires outbound HTTPS
  • Verify no firewall is blocking the connection

Verifying Setup​

Test MotherDuck connectivity:

duckdb "md:my_analytics?motherduck_token=your_token" -c "SELECT 1"

Test cloud storage access from MotherDuck:

SELECT * FROM read_parquet('s3://your-bucket/path/to/file.parquet') LIMIT 1;

Configuring Storage Secrets​

See Storage Access from MotherDuck in Prerequisites for detailed instructions on configuring S3, GCS, or Azure secrets.

Comparison with Other Targets​

FeatureMotherDuckBigQuerySnowflakeDuckLake
Query EngineDuckDBBigQuerySnowflakeDuckDB
External TablesViews with read_parquet()External tablesExternal tablesDuckLake catalog
Native TablesCREATE TABLE AS SELECTLoad jobsCOPY INTONot supported
ServerlessYesYesNo (warehouse required)N/A (local)
SQL DialectDuckDB/PostgreSQLBigQuery SQLSnowflake SQLDuckDB/PostgreSQL
Best ForAnalytics, explorationLarge-scale analyticsEnterprise data warehouseLocal development

See Also​

Copyright © 2026 Architecture & Performance.