Linking Cloudflare R2 Data Catalog as a source

Let AI connect your sources for you

Skip the manual setup — run this in your project and the wizard auto-detects your databases and APIs and connects them to PostHog.

PostHog Wizard hedgehog

The Cloudflare R2 Data Catalog source syncs each Apache Iceberg table in an R2 bucket's catalog into PostHog through the Iceberg REST catalog API. PostHog reads the tables' Parquet data files using storage credentials that the catalog vends. Cloudflare also calls R2 Data Catalog the Basin Catalog.

To import plain files (CSV, JSON Lines, Parquet, or Delta Lake tables) instead of Iceberg tables, use the Cloudflare R2 source.

Prerequisites

You need:

  • R2 Data Catalog turned on for your bucket in the Cloudflare dashboard
  • An R2 API token with the Admin Read only permission, which gives read access to the catalog and to R2 storage

See Cloudflare's catalog management docs for details.

Adding a data source

  1. In PostHog, go to the Sources tab of the data pipeline section.
  2. Click + New source and click Link next to this source.
  3. Enter your credentials (see Configuration below) and click Next.
  4. Select the tables you want to sync, choose a sync method and frequency, then click Import.

Once the syncs are complete, you can start querying this data in PostHog.

When you link R2 Data Catalog, enter:

  • Account ID - Your Cloudflare account ID as shown in the dashboard. Enter the ID, not a URL.
  • Bucket name - The R2 bucket that holds the catalog.
  • API token - The R2 API token that you created.
  • Catalog URI (optional) - Only fill this in when the catalog's page in the Cloudflare dashboard shows a URI different from https://catalog.cloudflarestorage.com/<account ID>/<bucket name>.

The catalog URI must use https and a host under cloudflarestorage.com. PostHog only sends your API token to hosts under cloudflarestorage.com.

If you change the account ID, bucket name, or catalog URI, you need to enter the API token again.

Tables

PostHog shows each table as namespace.table. Nested namespaces are joined with dots. Discovery lists up to 1,000 tables and walks up to 1,000 namespaces.

PostHog detects primary keys from the identifier fields in the Iceberg schema.

Sync methods

This source supports Full table and Incremental sync methods. Append only isn't supported.

You can use Iceberg columns of type int, long, date, timestamp, timestamptz, timestamp_ns, or timestamptz_ns as incremental fields.

Incremental syncs skip data files whose upper bound for the incremental column is below the last synced value. Rows are merged on the primary key, and rows at the last synced value are read again.

Limitations

  • Only Parquet data files are supported.
  • Position deletes are supported, but equality deletes and deletion vectors aren't. Compact the table, then sync again.
  • Data files over 4 GiB fail to sync. Compact the table into smaller files.
  • Tables with more than 50 million position deletes fail to sync. Compact the table.

Configuration

OptionTypeRequired
Account IDtextYes
Bucket nametextYes
API tokenpasswordYes
Catalog URI (optional)textNo

Supported tables

The tables available from this source are discovered from your account when you connect it, so the exact list depends on your data. Once connected, you can pick which tables to sync from the sources tab.

Troubleshooting

ProblemSolution
The API token is rejectedCreate an R2 API token with the Admin Read only permission and reconnect the source.
PostHog can't find a catalog for the bucketCheck the account ID and bucket name, and make sure R2 Data Catalog is turned on for the bucket.
The token can't read files, or the catalog returns no storage credentialsGive the token read permission for R2 storage.
The incremental column no longer exists in the tablePick another incremental column in the table's sync settings.

If your sync is failing or data looks wrong, see the Data warehouse troubleshooting guide. If that doesn't help, contact support – we're happy to help.

Still have questions?

Was this page useful?