You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below is an example of using [DuckDB](https://duckdb.org/) to connect to R2 Data Catalog (read-only). For more information on connecting to R2 Data Catalog with DuckDB, refer to [DuckDB documentation](https://duckdb.org/docs/stable/core_extensions/iceberg/iceberg_rest_catalogs#r2-catalog).
7
+
8
+
## Prerequisites
9
+
10
+
- Sign up for a [Cloudflare account](https://dash.cloudflare.com/sign-up/workers-and-pages).
11
+
-[Create an R2 bucket](/r2/buckets/create-buckets/) and [enable the data catalog](/r2/data-catalog/manage-catalogs/#enable-r2-data-catalog-on-a-bucket).
12
+
-[Create an R2 API token](/r2/api/tokens/) with both [R2 and data catalog permissions](/r2/api/tokens/#permissions).
- Note: [DuckDB 1.3.0](https://github.com/duckdb/duckdb/releases/tag/v1.3.0) or greater is required to attach [Iceberg REST Catalogs](https://duckdb.org/docs/stable/core_extensions/iceberg/iceberg_rest_catalogs).
15
+
16
+
## Example usage
17
+
18
+
In the [DuckDB CLI](https://duckdb.org/docs/stable/clients/cli/overview.html) (Command Line Interface), run the following commands:
19
+
20
+
```sql
21
+
-- Install the iceberg DuckDB extension (if you haven't already) and load the extension.
22
+
INSTALL iceberg;
23
+
LOAD iceberg;
24
+
25
+
-- Create a DuckDB secret to store R2 Data Catalog credentials.
26
+
CREATE SECRET r2_secret (
27
+
TYPE ICEBERG,
28
+
TOKEN '<token>'
29
+
);
30
+
31
+
-- Attach R2 Data Catalog with the following ATTACH statement (read-only).
0 commit comments