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_BUCKETCopy 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
- Open Settings > Datasources > Add datasource, then choose Internal.
- Enter a unique Slug, such as
r2-analytics, and an optional Name. Set Database type to Cloudflare R2 SQL. - Enter these connection fields:
| Field | Value |
|---|---|
| Warehouse | The warehouse name from step 1, such as 0123456789abcdef_analytics-lake. |
| Token | The 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
- Select Test connection. If it succeeds, select Create.
- Follow Connect a datasource to add the intended tables to Context. Check that the expected tables and columns appear.
- 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
| Symptom | What to check |
|---|---|
| Warehouse format error | The value must be ACCOUNT_ID_BUCKET, copied from the catalog details. |
| Authentication failure | Use 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 tables | Confirm the catalog is enabled on that bucket and contains Iceberg tables. |
| Query error | R2 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.
Last updated on November 27, 2026