Datasource setup

Connect Cloudflare R2 SQL

Query Apache Iceberg tables in a Cloudflare R2 Data Catalog through R2 SQL, using a warehouse name and an R2 API token.

Cloudflare has renamed R2 Data Catalog and R2 SQL to Basin Catalog and Basin SQL. Querio still lists this datasource as Cloudflare R2 SQL; existing catalogs and tokens work under either name.

You need permission to manage datasources in Querio and access to the Cloudflare account that owns the R2 bucket. The bucket must already contain Iceberg tables. The examples below use analytics.orders; substitute your own namespace, table and columns.

1. Enable the catalog on your bucket

In the Cloudflare dashboard, open R2, select the bucket and enable its data catalog, or run:

npx wrangler basin catalog enable YOUR_BUCKET

Copy the Warehouse name from the catalog details or the command output. It has the form ACCOUNT_ID_BUCKET, for example 0123456789abcdef_analytics-lake. See Cloudflare's Manage catalogs guide.

2. Create an R2 API token

In R2 > Manage API tokens, create an Account API token with Admin Read & Write permission, the access Cloudflare requires for R2 SQL queries. Scope it to the bucket Querio should read. Copy the Token value; Querio does not use the S3 access key or secret.

R2 SQL is a read-only engine, so queries cannot change your tables. The token itself can write to the bucket, so store it only in the Querio connection form.

3. Enter the connection in Querio

  1. Open Settings > Datasources > Add datasource, then choose Internal.
  2. Enter a unique Slug, such as r2-analytics, and an optional Name. Set Database type to Cloudflare R2 SQL.
  3. Enter these connection fields:
FieldValue
WarehouseThe warehouse name from step 1, such as 0123456789abcdef_analytics-lake.
TokenThe R2 API token value from step 2.

Iceberg namespaces appear as schemas in Querio's catalog, and nested namespaces are joined with dots. Use fully qualified table names, such as analytics.orders, in queries.

4. Test the connection and query a table

  1. Select Test connection. If it succeeds, select Create.
  2. Follow Connect a datasource to add the intended tables to Context. Check that the expected tables and columns appear.
  3. Open an Explore with the datasource selected and run a small read:
SELECT order_id, status
FROM analytics.orders
LIMIT 5;

R2 SQL bills by data scanned. Filter and limit exploratory queries; see Cloudflare's R2 SQL pricing.

If a check fails

SymptomWhat to check
Warehouse format errorThe value must be ACCOUNT_ID_BUCKET, copied from the catalog details.
Authentication failureUse the R2 API token value, not an S3 access key or a general Cloudflare API key, and check that it covers the bucket.
No schemas or tablesConfirm the catalog is enabled on that bucket and contains Iceberg tables.
Query errorR2 SQL supports read-only analytical SQL. Check the qualified table name and Cloudflare's SQL reference.

For shared credential and access troubleshooting, see Datasources and credentials. If the failure remains unexplained, use Troubleshoot and get help with secrets redacted.

Was this page helpful?

Last updated on November 27, 2026

On this page