No logo available for Supabase to DuckDB connector icon

Load Supabase data to DuckDB

Build a Supabase to DuckDB pipeline with your coding agent. One prompt scaffolds it with the dltHub AI harness, plus the Supabase API base URL, auth, endpoints, and incremental loading.

SourceSupabaseSupabase API DocumentationDestinationDuckDBIn-process analytical database. The default local destination for dlt pipelines.

Supabase provides a RESTful data API powered by PostgREST that enables direct interaction with your PostgreSQL database tables and functions. Everything needed to build a working Supabase → DuckDB pipeline is on this page: the API's base URL, authentication, endpoints, pagination and incremental field — plus a prompt that hands the whole job to your coding agent.


Build your Supabase to DuckDB pipeline

Paste this prompt into Claude, Codex, or Cursor. The agent does the rest.

Prompt
Run uvx dlthub-init@latest to build a pipeline from Supabase to DuckDB and run it on dltHub

That scaffolds a dltHub workspace and installs the dltHub AI harness — the project rules, the secrets-management skill, and the dlt MCP server your agent needs to work safely. From there it reads the Supabase API, proposes the endpoints to load, then writes, runs and validates the pipeline while you review rather than type. Credentials are inspected through MCP tools, so your agent never reads secrets.toml itself. How the LLM-native workflow works →

Prefer to write it yourself? Every fact the agent uses is below.


Supabase API at a glance

Base URLhttps://<project_ref>.supabase.co/rest/v1
Example endpointGET {table}
Authenticationrequests require an 'apikey' header for the project key and an optional 'Authorization' header for user-specific JWTs — sent in the Authorization header, prefixed Bearer
Also requiredapikey
PaginationPage-number
Incremental fieldid
Record idid
API referencehttps://supabase.com/docs/guides/api

These values come from the Supabase API reference — the authoritative source if anything here looks out of date.


How do I authenticate with the Supabase API?

All requests require the 'apikey' header, which should be set to your project's publishable or secret API key. For authenticated requests, the 'Authorization' header must also be provided with a 'Bearer ' format, where the token is a user JWT or an access token.

1. Get your credentials

  1. Log in to your Supabase Dashboard. 2. Select your project from the dashboard. 3. In the sidebar, navigate to Settings > API Keys to find your API URL and keys (publishable and secret). Alternatively, you can use the Connect dialog accessible from the project overview page to quickly copy these credentials. Note that legacy keys (anon/service_role) may still be visible in the Legacy API Keys tab, but you should prioritize using the newer publishable and secret keys.

2. Add them to .dlt/secrets.toml

[sources.supabase_source] supabase_url = "https://<project_ref>.supabase.co" supabase_key = "<your_publishable_or_secret_key>"

dlt reads this file automatically at runtime. With the harness, the setup-secrets skill prompts you for the values and never handles the raw credential in chat. For production, see setting up credentials with dlt.


What Supabase data can I load into DuckDB?

These are the Supabase endpoints dlt can load into DuckDB:

ResourceEndpointMethodData selectorDescription
table_rows/{table}GETSelect rows from a table (supports filtering, sorting, pagination, and column selection)
table_rows_count/{table}GETGet row count (using Prefer: count=exact header)
rpc_function/rpc/{function_name}POSTCall a Postgres function
table_rows_limited/{table}?limit={n}GETRetrieve a limited number of rows
table_rows_offset/{table}?limit={n}&offset={m}GETRetrieve a limited number of rows with offset

How do I load only new Supabase records?

Supabase exposes id on {table}, so dlt can request only the records that changed since the last run. Set it as the cursor_path and dlt tracks the high-water mark for you between runs.

{"name": "table_rows", "endpoint": { "path": "{table}", "incremental": {"cursor_path": "id", "initial_value": "2024-01-01T00:00:00Z"}, }}

On the first run dlt loads everything from initial_value; on every run after that it requests only what changed and appends with write_disposition="merge" if you set a primary key. See incremental loading.


What does the generated Supabase pipeline look like?

A standard dlt REST API pipeline — the same code you would write by hand, loading /rest/v1/<table_name> and /rest/v1/rpc/<function_name> from the Supabase API into DuckDB:

import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def supabase_source(apikey=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://<project_ref>.supabase.co/rest/v1", "auth": {"type": "bearer", "token": apikey}, }, "resources": [ {"name": "table_rows", "endpoint": {"path": "{table}"}}, {"name": "table_rows_limited", "endpoint": {"path": "{table}?limit={limit}"}} ], } yield from rest_api_resources(config) def load_supabase_to_duckdb() -> None: pipeline = dlt.pipeline( pipeline_name="supabase_pipeline", destination="duckdb", dataset_name="supabase_data", ) load_info = pipeline.run(supabase_source()) print(load_info) if __name__ == "__main__": load_supabase_to_duckdb()

Run it with python supabase_pipeline.py. The agent iterates on this until it loads cleanly — you review and approve, rather than write it from scratch.


How do I query Supabase data in DuckDB?

dlt creates one table per resource. Query the loaded data with Python or SQL — or ask your agent to, through the MCP server's execute_sql_query tool.

Python (pandas DataFrame):

import dlt data = dlt.pipeline("supabase_pipeline").dataset() df = data.table_rows.df() print(df.head())

SQL:

SELECT * FROM supabase_data.table_rows LIMIT 10;

See querying your data with dataset and exploring it in marimo notebooks.


How do I deploy the Supabase to DuckDB pipeline in production?

The pipeline runs locally, which is ideal for prototyping and one-off analysis. When you need it on a schedule, monitored on every load, and shared with your team, deploy the same dlt code on the dltHub platform — no infrastructure to maintain. The prompt above already ends with "run it on dltHub", so your agent can take it there directly.

  • Deploy & schedule — run the pipeline as a managed job with automatic retries.
  • Monitor — observable job queues, alerting, and load metrics for every run.
  • Transform — promote raw Supabase loads into governed, documented models.
  • Visualize & share — explore data in notebooks and publish live dashboards instead of static screenshots.

Book a demo →


What other destinations can I load Supabase data to?

dlt loads into any of these — only the destination argument changes:

DestinationExample value
PostgreSQL"postgres"
BigQuery"bigquery"
Snowflake"snowflake"
Redshift"redshift"
Databricks"databricks"
Filesystem (S3, GCS, Azure)"filesystem"

Set dlt.pipeline(destination="snowflake") and add credentials in .dlt/secrets.toml. On the dltHub platform the same pipeline runs against a managed Iceberg lakehouse. See the full destinations list.


Next steps

Was this page helpful?

Community Hub

Need more dlt context for Supabase to DuckDB?

Request dlt skills, commands, AGENT.md files, and AI-native context.