Skip to content

Commit d91279b

Browse files
committed
PCX review + adding Steps
1 parent 0a0af5f commit d91279b

File tree

1 file changed

+50
-45
lines changed
  • src/content/docs/r2/data-catalog/config-examples

1 file changed

+50
-45
lines changed

src/content/docs/r2/data-catalog/config-examples/trino.mdx

Lines changed: 50 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Apache Trino
33
pcx_content_type: example
44
---
55

6+
import { Steps } from "~/components"
7+
68
Below is an example of using [Apache Trino](https://trino.io/) to connect to R2 Data Catalog. For more information on connecting to R2 Data Catalog with Trino, refer to [Trino documentation](https://trino.io/docs/current/connector/iceberg.html).
79

810
## Prerequisites
@@ -38,54 +40,57 @@ iceberg.rest-catalog.oauth2.token=<Your R2 authentication token>
3840

3941
## Example usage
4042

41-
Start Trino with the R2 catalog configuration:
43+
<Steps>
4244

43-
```bash
44-
# Create a local directory for the catalog configuration
45-
mkdir -p trino-catalog
45+
1. Start Trino with the R2 catalog configuration:
4646

47-
# Place your r2.properties file in the catalog directory
48-
cp r2.properties trino-catalog/
47+
```bash
48+
# Create a local directory for the catalog configuration
49+
mkdir -p trino-catalog
4950

50-
# Run Trino with the catalog configuration
51-
docker run -d \
52-
--name trino-r2 \
53-
-p 8080:8080 \
54-
-v $(pwd)/trino-catalog:/etc/trino/catalog \
55-
trinodb/trino:latest
56-
```
51+
# Place your r2.properties file in the catalog directory
52+
cp r2.properties trino-catalog/
5753

58-
Connect to Trino and query your R2 Data Catalog:
54+
# Run Trino with the catalog configuration
55+
docker run -d \
56+
--name trino-r2 \
57+
-p 8080:8080 \
58+
-v $(pwd)/trino-catalog:/etc/trino/catalog \
59+
trinodb/trino:latest
60+
```
5961

60-
```bash
61-
# Connect to the Trino CLI
62-
docker exec -it trino-r2 trino
63-
```
62+
2. Connect to Trino and query your R2 Data Catalog:
63+
64+
```bash
65+
# Connect to the Trino CLI
66+
docker exec -it trino-r2 trino
67+
```
68+
69+
3. In the Trino CLI, run the following commands:
70+
71+
```sql
72+
-- Show all schemas in the R2 catalog
73+
SHOW SCHEMAS IN r2;
74+
75+
-- Show all schemas in the R2 catalog
76+
CREATE SCHEMA r2.example_schema
77+
78+
-- Create a table with some values in it
79+
CREATE TABLE r2.example_schema.yearly_clicks (
80+
year,
81+
clicks
82+
)
83+
WITH (
84+
partitioning = ARRAY['year']
85+
)
86+
AS VALUES
87+
(2021, 10000),
88+
(2022, 20000);
89+
90+
-- Show tables in a specific schema
91+
SHOW TABLES IN r2.example_schema;
6492

65-
In the Trino CLI, run the following commands:
66-
67-
```sql
68-
-- Show all schemas in the R2 catalog
69-
SHOW SCHEMAS IN r2;
70-
71-
-- Show all schemas in the R2 catalog
72-
CREATE SCHEMA r2.example_schema
73-
74-
-- Create a table with some values in it
75-
CREATE TABLE r2.example_schema.yearly_clicks (
76-
year,
77-
clicks
78-
)
79-
WITH (
80-
partitioning = ARRAY['year']
81-
)
82-
AS VALUES
83-
(2021, 10000),
84-
(2022, 20000);
85-
86-
-- Show tables in a specific schema
87-
SHOW TABLES IN r2.example_schema;
88-
89-
-- Query your Iceberg table
90-
SELECT * FROM r2.example_schema.yearly_clicks;
91-
```
93+
-- Query your Iceberg table
94+
SELECT * FROM r2.example_schema.yearly_clicks;
95+
```
96+
</Steps>

0 commit comments

Comments
 (0)