Supabase
Supabase is a Postgres platform for building applications with a managed database, APIs, authentication, storage, and realtime features. Supabase's documented DuckDB Wrapper can query MotherDuck from a Supabase Postgres database through a foreign data wrapper.
How it works with MotherDuck
- Enable the Supabase Wrappers extension.
- Create the
duckdb_wrapperforeign data wrapper. - Store a MotherDuck token in Supabase Vault, then create a foreign server with
type 'md', the MotherDuck database name, and the Vault-backed token option. - Create a schema for the foreign tables.
- Import a MotherDuck schema, such as
main, into Supabase and query the imported foreign tables from Postgres.
create extension if not exists wrappers with schema extensions;
create foreign data wrapper duckdb_wrapper
handler duckdb_fdw_handler
validator duckdb_fdw_validator;
create server duckdb_server_md
foreign data wrapper duckdb_wrapper
options (
type 'md',
database 'my_db',
vault_motherduck_token '<vault_secret_id>'
);
create schema if not exists duckdb;
import foreign schema "main"
from server duckdb_server_md into duckdb;
select *
from duckdb.my_table
limit 10;
The Supabase DuckDB Wrapper is a read path into MotherDuck: it supports querying foreign tables, including where, order by, and limit pushdown, but does not support inserts, updates, deletes, or truncates through the foreign tables.