Skip to content

Commit 8f01cf9

Browse files
jcockhrenthomasgauvin
authored andcommitted
An example of using the StarRocks Iceberg engine with Data Catalog (#22936)
1 parent fc8c65f commit 8f01cf9

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: StarRocks
3+
pcx_content_type: example
4+
---
5+
6+
Below is an example of using [StarRocks](https://docs.starrocks.io/docs/data_source/catalog/iceberg/iceberg_catalog/#rest) to connect, query, modify data from R2 Data Catalog (read-write).
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).
13+
- A running [StarRocks](https://www.starrocks.io/) frontend instance. You can use the [all-in-one](https://docs.starrocks.io/docs/quick_start/shared-nothing/#launch-starrocks) docker setup.
14+
15+
## Example usage
16+
17+
In your running StarRocks instance, run these commands:
18+
19+
```sql
20+
-- Create an Iceberg catalog named `r2` and set it as the current catalog
21+
22+
CREATE EXTERNAL CATALOG r2
23+
PROPERTIES
24+
(
25+
"type" = "iceberg",
26+
"iceberg.catalog.type" = "rest",
27+
"iceberg.catalog.uri" = "<r2_catalog_uri>",
28+
"iceberg.catalog.security" = "oauth2",
29+
"iceberg.catalog.oauth2.token" = "<r2_api_token>",
30+
"iceberg.catalog.warehouse" = "<r2_warehouse_name>"
31+
);
32+
33+
SET CATALOG r2;
34+
35+
-- Create a database and display all databases in newly connected catalog
36+
37+
CREATE DATABASE testdb;
38+
39+
SHOW DATABASES FROM r2;
40+
41+
+--------------------+
42+
| Database |
43+
+--------------------+
44+
| information_schema |
45+
| testdb |
46+
+--------------------+
47+
2 rows in set (0.66 sec)
48+
```

0 commit comments

Comments
 (0)