Skip to content

Commit c261553

Browse files
committed
feat(dwh): update
1 parent 432d712 commit c261553

File tree

2 files changed

+177
-14
lines changed

2 files changed

+177
-14
lines changed

pages/data-warehouse/how-to/connect-applications.mdx

Lines changed: 168 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,179 @@ To connect your deployment with BI tools, refer to the [dedicated documentation]
3030

3131
3. Click the **Actions** button in the top-right corner of the page. A drop-down menu displays.
3232

33-
4. Select ¨**Connect using frameworks**. The connection wizard displays.
33+
4. Select **Connect using frameworks**. The connection wizard displays.
3434

3535
<Message type="note">
3636
To connect your deployment with BI tools, refer to the [dedicated documentation](/data-warehouse/how-to/connect-bi-tools/).
3737
</Message>
3838

39-
5. Click the **Download** link to download the required TLS certificate.
39+
5. Select your preferred framework:
4040

41-
6. Select your preferred framework:
42-
- Protocols: Select the appropriate protocol, then run the displayed command in a terminal. Remember to replace the placeholders with the appropriate values, and to specify the correct path to the certificate file.
43-
- Languages: Select the desired language, then add the code displayed to your application code. Remember to replace the placeholders with the appropriate values, and to specify the correct path to the certificate file.
41+
**Protocols**
42+
43+
Select the appropriate protocol, then run the displayed command in a terminal. Remember to replace the placeholders with the appropriate values, and to specify the correct path to the certificate file.
44+
45+
<Tabs id="data-warehouse-connect-protocols">
46+
<TabsTab label="ClicHouse® CLI">
47+
```sh
48+
clickhouse client \
49+
--host <YOUR_DEPLOYMENT_ID>.dtwh.<REGION>.scw.cloud \
50+
--port 9440 \
51+
--secure \
52+
--user scwadmin \
53+
--password '<PASSWORD>'
54+
```
55+
</TabsTab>
56+
<TabsTab label="MySQL">
57+
```sh
58+
mysql -h <YOUR_DEPLOYMENT_ID>.dtwh.<REGION>.scw.cloud \
59+
-P 9004 \
60+
-u scwadmin \
61+
--password='<PASSWORD>' -e "SELECT 1;"
62+
```
63+
<Message type="note">
64+
MySQL connection is exposed publicly. Use ClickHouse® CLI for a secure connection.
65+
</Message>
66+
</TabsTab>
67+
<TabsTab label="HTTPS">
68+
```sh
69+
echo 'SELECT 1' | curl 'https://scwadmin:<PASSWORD>@<YOUR_DEPLOYMENT_ID>.dtwh.<REGION>.scw.cloud:443' -d @-
70+
```
71+
<Message type="note">
72+
`curl` only works with SQL queries, and does not allow direct connection to your Data Warehouse for ClickHouse® deployment.
73+
</Message>
74+
</TabsTab>
75+
</Tabs>
76+
<br/>
77+
**Languages**
78+
79+
Select the desired language, then run the code displayed to create a file that connects to your deployment, and run queries programmatically. Remember to replace the placeholders with the appropriate values, and to specify the correct path to the certificate file.
80+
81+
<Tabs id="data-warehouse-connect-languages">
82+
<TabsTab label="Python">
83+
```python
84+
pip install clickhouse-connect
85+
cat <<EOF >clickhouse.py
86+
import clickhouse_connect
87+
88+
client = clickhouse_connect.get_client(
89+
host="<YOUR_DEPLOYMENT_ID>.dtwh.<REGION>.scw.cloud",
90+
port=443,
91+
username="scwadmin",
92+
password="<PASSWORD>",
93+
)
94+
query_result = client.query("SELECT 1")
95+
print(query_result.result_set)
96+
EOF
97+
python clickhouse.py
98+
```
99+
</TabsTab>
100+
<TabsTab label="Go">
101+
```go
102+
mkdir ClickHouse-go
103+
cd ClickHouse-go
104+
go mod init ClickHouse-go
105+
cat <<EOF >main.go
106+
package main
107+
108+
import (
109+
"context"
110+
"fmt"
111+
"log"
112+
"github.com/ClickHouse/clickhouse-go/v2"
113+
)
114+
115+
func main() {
116+
conn, err := clickhouse.Open(&clickhouse.Options{
117+
Addr: []string{"f133556f-8578-486f-be7f-49f7da08b728.dtwh.fr-par.scw.cloud:9440"},
118+
Auth: clickhouse.Auth{
119+
Database: "default",
120+
Username: "scwadmin",
121+
Password: "PASSWORD",
122+
},
123+
})
124+
if err != nil {
125+
log.Fatal(err)
126+
}
127+
defer conn.Close()
128+
129+
ctx := context.Background()
130+
var result string
131+
if err := conn.QueryRow(ctx, "SELECT 1").Scan(&result); err != nil {
132+
log.Fatal(err)
133+
}
134+
fmt.Println(result)
135+
}
136+
EOF
137+
go run .
138+
```
139+
</TabsTab>
140+
<TabsTab label="Node.js">
141+
```node
142+
npm i @clickhouse/client
143+
cat <<EOF >clickhouse.js
144+
import { createClient } from '@clickhouse/client'
145+
146+
void (async () => {
147+
const client = createClient({
148+
url: 'https://f133556f-8578-486f-be7f-49f7da08b728.dtwh.fr-par.scw.cloud:443',
149+
username: 'scwadmin',
150+
password: 'PASSWORD'
151+
})
152+
const rows = await client.query({
153+
query: 'SELECT 1',
154+
format: 'JSONEachRow',
155+
})
156+
console.info(await rows.json())
157+
await client.close()
158+
})()
159+
EOF
160+
node clickhouse.js
161+
```
162+
</TabsTab>
163+
<TabsTab label="Java">
164+
```java
165+
cat <<EOF >pom.xml
166+
<?xml version="1.0" encoding="UTF-8"?>
167+
<project
168+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
169+
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
170+
<modelVersion>4.0.0</modelVersion>
171+
<groupId>clickhouse-java</groupId>
172+
<artifactId>clickhouse-java</artifactId>
173+
<version>1.0.0</version>
174+
<packaging>jar</packaging>
175+
<dependencies>
176+
<dependency>
177+
<groupId>com.clickhouse</groupId>
178+
<artifactId>clickhouse-jdbc</artifactId>
179+
<version>0.7.2</version>
180+
</dependency>
181+
</dependencies>
182+
</project>
183+
EOF
184+
mkdir -p src/main/java
185+
cat <<EOF >src/main/java/Main.java
186+
import java.sql.*;
187+
import java.lang.ClassNotFoundException;
188+
189+
public class Main {
190+
public static void main(String[] args) throws SQLException, ClassNotFoundException {
191+
Class.forName("com.clickhouse.jdbc.ClickHouseDriver");
192+
String url = "jdbc:ch://scwadmin:PASSWORD@f133556f-8578-486f-be7f-49f7da08b728.dtwh.fr-par.scw.cloud:443/default?ssl=true";
193+
try (Connection con = DriverManager.getConnection(url); Statement stmt = con.createStatement()) {
194+
ResultSet result_set = stmt.executeQuery("SELECT 1 AS one");
195+
while (result_set.next()) {
196+
System.out.println(result_set.getInt("one"));
197+
}
198+
}
199+
}
200+
}
201+
EOF
202+
mvn clean compile
203+
mvn exec:java -Dexec.mainClass=Main
204+
```
205+
</TabsTab>
206+
</Tabs>
44207

45208
You are now connected to your Data Warehouse for ClickHouse® deployment using the administrator account.

pages/data-warehouse/index.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
meta:
3-
title: Data Warehouse Documentation
4-
description: Dive into Scaleway Data Warehouse with our quickstart guides, how-tos, tutorials and more.
3+
title: Data Warehouse for ClickHouse® Documentation
4+
description: Dive into Scaleway Data Warehouse for ClickHouse® with our quickstart guides, how-tos, tutorials and more.
55
---
66

77
<ProductHeader
8-
productName=" Data Warehouse"
8+
productName=" Data Warehouse for ClickHouse®"
99
productLogo="dataWarehouse"
10-
description=" Data Warehouse is designed to help users in their reporting and data analysis tasks for business intelligence."
10+
description=" Data Warehouse for ClickHouse® is designed to help users in their reporting and data analysis tasks for business intelligence."
1111
url="/data-warehouse/quickstart"
12-
label=" Data Warehouse Quickstart"
12+
label=" Data Warehouse for ClickHouse® Quickstart"
1313
/>
1414

1515
## Getting Started
@@ -18,28 +18,28 @@ meta:
1818
<SummaryCard
1919
title="Quickstart"
2020
icon="rocket"
21-
description="Learn how to create, use, manage, and delete a Data Warehouse in a few steps."
21+
description="Learn how to create, use, manage, and delete a Data Warehouse for ClickHouse® in a few steps."
2222
label="View Quickstart"
2323
url="/data-warehouse/quickstart/"
2424
/>
2525
<SummaryCard
2626
title="Concepts"
2727
icon="info"
28-
description="Core concepts that give you a better understanding of Scaleway Data Warehouse."
28+
description="Core concepts that give you a better understanding of Scaleway Data Warehouse for ClickHouse®."
2929
label="View Concepts"
3030
url="/data-warehouse/concepts/"
3131
/>
3232
<SummaryCard
3333
title="How-tos"
3434
icon="help-circle-outline"
35-
description="Check our guides to creating, using, and managing Data Warehouses and their features."
35+
description="Check our guides to creating, using, and managing Data Warehouse for ClickHouse® deployments and their features."
3636
label="View How-tos"
3737
url="/data-warehouse/how-to/"
3838
/>
3939
<SummaryCard
4040
title="How-tos"
4141
icon="help-circle-outline"
42-
description="Check our guides to creating, using, and managing Data Warehouses and their features."
42+
description="Check our guides to creating, using, and managing Data Warehouse for ClickHouse® deployments and their features."
4343
label="View How-tos"
4444
url="/data-warehouse/how-to/"
4545
/>

0 commit comments

Comments
 (0)