Skip to main content

DuckLake

Use a PostgreSQL database as the metadata catalog for your DuckLake table. Send2Bucket appends each delivery batch in a single DuckLake transaction.

What you provide​

FieldKindExample
data_pathsettings3://analytics-lake/ducklake/. Used when the lake is created; an existing lake keeps its own.
metadata_schemasetting, optionalThe Postgres schema holding DuckLake's metadata tables
namespacesettingThe DuckLake schema for the table. Defaults to main.
tablesettingevents
catalogsettingWhere the catalog lives: dsn, a Postgres you run and name with a DSN, or supabase, a project Send2Bucket sets up for you. Defaults to dsn.
catalog_dsncredential, dsn onlyA libpq string: host=db.example.com dbname=lake user=s2bucket password=…
catalog_project_refset for you, supabase onlyThe Supabase project holding the catalog. Send2Bucket fills it in, with metadata_schema, when it creates the catalog.
storagesettingWhere the data path lives: s3 (Amazon S3), r2 (Cloudflare R2), supabase (Supabase Storage) or s3_compatible. Defaults to s3.
account_idsetting, R2 onlyYour Cloudflare account ID. The endpoint is https://<account_id>.r2.cloudflarestorage.com.
project_refsetting, Supabase Storage onlyThe project that holds the bucket. The endpoint is https://<project_ref>.storage.supabase.co/storage/v1/s3.
access_key_id, secret_access_keycredentialAn S3 key that can read and write under the data path. For Supabase Storage, create one under Storage → S3 in the project.
regionsetting, not for R2The data path's region, for example us-east-1. For Supabase Storage, the project's region.
endpointsetting, s3_compatible onlyThe storage's S3 endpoint, for example https://minio.example.com

The catalog must be reachable from Send2Bucket over TLS. Create a dedicated database user for Send2Bucket, with rights only on the catalog database.

For an end-to-end walkthrough with events, OpenTelemetry and maintenance, see Stream events and OpenTelemetry into DuckLake.

Setup​

Your own Postgres​

  1. Create the catalog database and the user:

    CREATE USER s2bucket WITH PASSWORD '<password>';
    CREATE DATABASE lake OWNER s2bucket;
  2. Add the destination in the dashboard and select Verify. Send2Bucket attaches the catalog, creates the table in the namespace if it is missing, or checks an existing table's columns.

A Supabase project​

Send2Bucket creates the catalog in a project of yours through Supabase's Management API.

  1. Add a destination of kind DuckLake · catalog and data in Supabase. On an existing DuckLake, set catalog to supabase instead.
  2. Select connect Supabase and approve Send2Bucket for your Supabase organization. One connection serves the whole workspace.
  3. Choose the project and select create catalog. Send2Bucket creates a schema s2b_lake_<id>, a writer role it keeps, and a read-only role whose password it shows once, in a DuckDB snippet. When storage is supabase in the same project, it also creates the bucket named in data_path, or, with no data_path yet, a bucket s2b-ducklake with a folder for this lake.
  4. Name the table, paste an S3 access key from the project's Storage settings, save and select Verify.

Send2Bucket reaches the catalog through the project's connection pooler in session mode. Selecting rotate catalog credentials sets new passwords for both roles.

The destinations page shows who connected Supabase and when. An editor can disconnect it there: Send2Bucket revokes its access at Supabase and deletes its tokens. Catalogs it already created keep working, because each destination stores its own role passwords; creating or rotating a catalog needs connecting again.

Send2Bucket also maintains a lake whose catalog it created, nightly: it writes rows held in the catalog out to Parquet, merges small files, and expires snapshots older than 7 days, deleting the files only they used. Time travel therefore reaches back 7 days. A catalog you provide is yours to maintain.

The table has the columns in Delivery format. An existing table with other columns is left untouched, and setup fails with incompatible table: ….

Delivery and retries​

A batch is delivered when the DuckLake transaction that appends its rows commits. If the commit response is lost, Send2Bucket looks for the batch's delivery_batch_id in the table before trying again, so a retry does not append the rows twice.

Reading the table​

INSTALL ducklake;
ATTACH 'ducklake:postgres:dbname=lake host=db.example.internal user=analyst' AS lake
(DATA_PATH 's3://analytics-lake/ducklake/');
SELECT signal_type, count(*) FROM lake.main.events GROUP BY ALL;

Query your data​

  • DuckDB: attaches the lake read-only.
  • PostgreSQL: through pg_duckdb.
  • MySQL: load with DuckDB.
  • Python: Polars, PyIceberg or the duckdb package.
  • R: the duckdb package.

When Send2Bucket created the catalog in a Supabase project, the dashboard's query page and the MCP server's run_query also read the lake, as its read-only role. Their events view has the same columns as a bucket's.

To explore in a notebook or BI tool, see Integrations. The querying overview compares engines.