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
This page explains how to manage databases in your Data Warehouse for ClickHouse® deployment using the [Scaleway console](https://console.scaleway.com/).
13
-
14
-
<Messagetype="note">
15
-
During the private beta phase, database management can only be done with the **scwadmin** & via the ClickHouse® CLI, MySQL or HTTPS protocols.
16
-
</Message>
12
+
This page explains how to manage databases in your Data Warehouse for ClickHouse® deployment.
17
13
18
14
<Requirements />
19
15
20
16
- A Scaleway account logged into the [console](https://console.scaleway.com)
21
17
-[Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
22
-
-[Signed up to the private beta](https://www.scaleway.com/fr/betas/) and received a confirmation email.
23
18
- Created a [Data Warehouse deployment](/data-warehouse/how-to/create-deployment/)
24
19
25
20
## How to manage databases using the Scaleway console
26
21
27
-
During the private beta phase, the management of databases in your Data Warehouse for ClickHouse® deployment is limited to viewing databases in your deployment.
22
+
The Scaleway console allows you to create and delete databases for your Data Warehouse for ClickHouse® deployment.
23
+
24
+
### How to create a database using the Scaleway console
25
+
26
+
1. Click **ClickHouse®** under **Data & Analytics** on the side menu. The Data Warehouse deployment page displays.
27
+
28
+
2. Click the name of the desired Data Warehouse deployment. The **Overview** tab of the deployment displays.
29
+
30
+
3. Click the **Databases** tab. A list of your current databases displays.
31
+
32
+
4. Click **+ Create database**. A pop-up displays.
33
+
34
+
5. Enter a name for your new database. It can can only contain alphanumeric characters, underscores, and dashes.
35
+
36
+
6. Click **Create database** to confirm.
37
+
38
+
Your new database appears in the list.
39
+
40
+
### How to delete a database using the Scaleway console
41
+
42
+
<Messagetype="note">
43
+
The `default` database cannot be deleted.
44
+
</Message>
45
+
46
+
1. Click **ClickHouse®** under **Data & Analytics** on the side menu. The Data Warehouse deployment page displays.
47
+
48
+
2. Click the name of the desired Data Warehouse deployment. The **Overview** tab of the deployment displays.
49
+
50
+
3. Click <Iconname="delete" /> next to the name of the database you want to delete. A confirmation pop-up displays.
51
+
52
+
4. Enter `DELETE`, then click **Delete database** to confirm.
53
+
54
+
The deleted database no longer appears in the list.
28
55
29
56
## How to manage databases using frameworks
30
57
31
-
[Connect to your deployment](/data-warehouse/how-to/connect-applications/) using your preferred framework.
32
-
<Messagetype="tip">
33
-
You can also connect using the ClickHouse HTTP console from the **Overview** tab of your deployment. Make sure to enter valid credentials in the top-right fields.
34
-
</Message>
58
+
[Connect to your deployment](/data-warehouse/how-to/connect-applications/) using your preferred framework.
59
+
60
+
<Messagetype="tip">
61
+
You can also connect using the ClickHouse HTTP console from the **Overview** tab of your deployment. Make sure to enter valid credentials in the top-right fields.
62
+
</Message>
35
63
36
64
Once connected, you can run SQL queries to `CREATE/ALTER/DROP` your `DATABASE/TABLE`.
- A Scaleway account logged into the [console](https://console.scaleway.com)
15
+
-[Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
16
+
17
+
## Overview
18
+
19
+
Scaleway Data Warehouse for ClickHouse® uses ClickHouse®'s native storage policies to decide where table data lives: on Scaleway Block storage, and/or on Object Storage (Amazon S3). Policies are applied at table-level during table creation, using the settings presented below. You can choose between three policies for your deployment:
20
+
21
+
-`tiered` (default in Scaleway Data Warehouse for ClickHouse®)
22
+
-`s3_cache` (cache mode)
23
+
-`default` (local-only mode)
24
+
25
+
The table below provides an overview of each storage policy's behavior and use case.
26
+
27
+
| Storage policy | Behavior | When to use |
28
+
|------|---------|------------|
29
+
|`tiered`| Writes on Block Storage first, and parts are automatically moved to Object Storage when disk is 90% full. | General purpose setting for fast local writes and transparent spillover to Object Storage as the dataset grows. |
30
+
|`s3_cache`| Data is stored on Object Storage. A local Block Storage cache layer keeps frequently-read parts to accelerate repeated reads. | Large datasets that mostly live in Object Storage, with repeated reads on smaller subsets that benefit from local caching. |
31
+
|`default`| Data is stored on Block storage only. | Small datasets where lowest latency for reads/writes on local disk is desired and capacity fits the Block Storage volume. |
32
+
33
+
## Tiered storage policy
34
+
35
+
### Applying the tiered policy
36
+
37
+
**Tiered** is the deployment's default policy. Data is stored on the `hot` volume (Block Storage) until it reaches 90% of its capacity, then data is moved to the `cold` volume. This mechanism is controlled by `move_factor:0.1`.
38
+
39
+
[Connect to you deployment](/data-warehouse/how-to/connect-applications/), then run the SQL query below to apply the `tiered` storage policy.
40
+
41
+
<Tabsid="tiered-explicit-implicit">
42
+
<TabsTablabel="Explicit">
43
+
44
+
Storage policy is explicitly defined as `tiered`.
45
+
46
+
```sql
47
+
CREATETABLEtiered_table
48
+
(
49
+
id UInt64,
50
+
ts DateTime,
51
+
value Float32
52
+
)
53
+
ENGINE = MergeTree
54
+
PARTITION BY toYYYYMM(ts)
55
+
ORDER BY id
56
+
SETTINGS storage_policy ='tiered';
57
+
```
58
+
59
+
</TabsTab>
60
+
<TabsTablabel="Implicit">
61
+
62
+
Storage policy is not defined, ClickHouse® applies the `tiered` storage policy by default.
63
+
64
+
```sql
65
+
CREATETABLEdw.tiered_table_implicit
66
+
(
67
+
id UInt64,
68
+
ts DateTime,
69
+
value Float32
70
+
)
71
+
ENGINE = MergeTree
72
+
PARTITION BY toYYYYMM(ts)
73
+
ORDER BY id;
74
+
```
75
+
</TabsTab>
76
+
</Tabs>
77
+
78
+
<Messagetype="note">
79
+
If you omit the `storage_policy` setting, ClickHouse® will automatically apply the `tiered` policy.
80
+
</Message>
81
+
82
+
### Moving data with the tiered policy
83
+
84
+
When using the `tiered` storage policy, you can manually move partitions between `hot` (Block Storage) and `cold` (Object Storage) volumes using the SQL queries below.
85
+
86
+
- Moving specific partitions to the `cold` volume (Object Storage):
87
+
88
+
```sql
89
+
ALTERTABLE tiered_table MOVE PARTITION '2024-08' TO VOLUME 'cold';
90
+
```
91
+
92
+
- Moving a non-partitioned table (`tuple()`) to the `cold` volume (Object Storage):
93
+
94
+
```sql
95
+
ALTERTABLE tiered_table_without_partitions MOVE PARTITION tuple() TO VOLUME 'cold';
96
+
```
97
+
98
+
- Moving a partition to the `hot` volume (Block Storage):
99
+
100
+
```sql
101
+
ALTERTABLE tiered_table MOVE PARTITION '2024-08' TO VOLUME 'hot';
102
+
```
103
+
- Moving a non-partitioned table (`tuple()`) to the `hot` volume (Block Storage):
104
+
105
+
```sql
106
+
ALTERTABLE tiered_table_without_partitions MOVE PARTITION tuple() TO VOLUME 'hot';
107
+
```
108
+
109
+
## S3 cache policy
110
+
111
+
[Connect to your deployment](/data-warehouse/how-to/connect-applications/), then run the SQL query below to create a new table with the `s3_cache` policy enabled.
112
+
```sql
113
+
CREATETABLEcache_table
114
+
(
115
+
id UInt64,
116
+
ts DateTime,
117
+
value Float32
118
+
)
119
+
ENGINE = MergeTree
120
+
PARTITION BY toYYYYMM(ts)
121
+
ORDER BY id
122
+
SETTINGS storage_policy ='s3_cache';
123
+
```
124
+
125
+
## Local-only policy
126
+
127
+
[Connect to your deployment](/data-warehouse/how-to/connect-applications/), then run the SQL query below to create a new table with the `default` (Block Storage only) policy enabled.
This page explains how to manage users in your Data Warehouse for ClickHouse® deployment using the [Scaleway console](https://console.scaleway.com/).
13
-
14
-
<Messagetype="note">
15
-
During the private beta phase, user management can only be done with the **scwadmin** user via the ClickHouse® CLI, MySQL or HTTPS protocols.
16
-
</Message>
12
+
This page explains how to manage users in your Data Warehouse for ClickHouse® deployment.
17
13
18
14
<Requirements />
19
15
20
16
- A Scaleway account logged into the [console](https://console.scaleway.com)
21
17
-[Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
22
-
-[Signed up to the private beta](https://www.scaleway.com/fr/betas/) and received a confirmation email.
23
18
- Created a [Data Warehouse deployment](/data-warehouse/how-to/create-deployment/)
24
19
25
20
## How to manage users using the Scaleway console
26
21
27
-
During the private beta phase, the management of users for your Data Warehouse for ClickHouse® deployment is limited to:
28
-
- Viewing users in your deployment
29
-
- Changing the password of an existing user
22
+
The Scaleway console allows you to create users for your Data Warehouse for ClickHouse® deployment, to grant them admin rights, to update their password, and to delete them.
23
+
24
+
### How to create a user using the Scaleway console
25
+
26
+
1. Click **ClickHouse®** under **Data & Analytics** on the side menu. The Data Warehouse deployment page displays.
27
+
28
+
2. Click the name of the desired Data Warehouse deployment. The **Overview** tab of the deployment displays.
29
+
30
+
3. Click the **Users** tab. A list of your current users displays.
31
+
32
+
4. Click **+ Create user**. A pop-up displays.
33
+
34
+
5. Enter a username. It must be unique, contain up to 63 characters, and must start with a letter. Only alphanumeric characters, underscores, and dashes are accepted.
35
+
36
+
6. Enter a password, or generate one automatically.
37
+
38
+
7. Enable the toggle if you want to grant admin rights to the user.
39
+
40
+
8. Click **Create user** to proceed.
41
+
42
+
The newly created user appears in the list of your deployment's users.
43
+
44
+
### How to update a user's password and admin rights
45
+
46
+
1. Click **ClickHouse®** under **Data & Analytics** on the side menu. The Data Warehouse deployment page displays.
47
+
48
+
2. Click the name of the desired Data Warehouse deployment. The **Overview** tab of the deployment displays.
49
+
50
+
3. Click the **Users** tab. A list of your current users displays.
51
+
52
+
4. Click <Iconname="more" /> next to the name of the user you want to update, then click **Update user**. A pop-up displays.
53
+
54
+
5. Update the user's password and/or admin rights, then click **Update user** to confirm.
55
+
56
+
### How to delete a user using the Scaleway console
57
+
58
+
1. Click **ClickHouse®** under **Data & Analytics** on the side menu. The Data Warehouse deployment page displays.
59
+
60
+
2. Click the name of the desired Data Warehouse deployment. The **Overview** tab of the deployment displays.
61
+
62
+
3. Click the **Users** tab. A list of your current users displays.
63
+
64
+
4. Click <Iconname="delete" /> next to the name of the user you want to delete. A confirmation pop-up displays.
65
+
66
+
5. Enter `DELETE`, then click **Delete user** to confirm.``
67
+
68
+
The user is deleted and no longer appears in the list.
30
69
31
70
## How to manage users using frameworks
32
71
@@ -37,4 +76,52 @@ During the private beta phase, the management of users for your Data Warehouse f
37
76
38
77
Once connected, you can run SQL queries using `USER`, `ROLE`, and `ROW POLICY` to create new users and grant them the desired permissions via roles.
39
78
40
-
Refer to the official ClickHouse® documentation on [users and roles](https://clickhouse.com/docs/sql-reference/statements/create/user) for more information.
79
+
Refer to the official ClickHouse® documentation on [users and roles](https://clickhouse.com/docs/sql-reference/statements/create/user) for more information.
80
+
81
+
## Manage user permissions
82
+
83
+
[Connect to your deployment](/data-warehouse/how-to/connect-applications/) using your preferred framework.
84
+
85
+
Once connected, you can run SQL as shown below to grant the desired permissions to users.
86
+
87
+
**Grant permission to create databases**
88
+
89
+
```sql
90
+
GRANT CREATE DATABASE ON . TO user;
91
+
```
92
+
93
+
**Grant permission to create tables in any database**
94
+
95
+
```sql
96
+
GRANT CREATE TABLE ON . TO user;
97
+
```
98
+
99
+
**Grant permission to create tables in a specific database**
100
+
101
+
```sql
102
+
GRANT CREATE TABLE ON database_name.* TO user;
103
+
```
104
+
105
+
**Grant data manipulation permissions for any table in any database**
106
+
107
+
```sql
108
+
GRANT INSERT, UPDATE, DELETEON . TO user;
109
+
```
110
+
111
+
**Grant data manipulation permissions for any table in a specific database**
112
+
113
+
```sql
114
+
GRANT INSERT, UPDATE, DELETEON database_name.* TO user;
115
+
```
116
+
117
+
**Grant data manipulation permissions for a specific table in a specific database**
118
+
119
+
```sql
120
+
GRANT INSERT, UPDATE, DELETEONdatabase_name.table_name TO user;
121
+
```
122
+
123
+
**Grant every permissions on every database**
124
+
125
+
```sql
126
+
GRANT CREATE DATABASE, CREATE TABLE, INSERT, UPDATE, DELETEON . TO user;
0 commit comments