ClickHouse / ClickHouse/ClickHouse

Add possibility to Revoke create materialized view permissions

Open
#87,028 0 comments 2 reactions 0 assignees View on GitHub
comp-rbac external feature
Dominant language
C++
Stars
49.9k
Forks
9k
Avg merge
21h 32m
Merged PRs (30d)
515

Description

### Company or project name

_No response_

### Use case

We have multiple multilayer materialized views from Kafka and rabbit, and a lot of users with different level of understanding of clickhouse limitations.

Data flow schema (objects in clickhouse):
```
streams.kafka_table -> (Kafka engine)
-> streams.kafka_table_mv -> (MaterializedView engine)
-> datamart.some_table (MergeTree engine)
```

Regular users does't have access to `streams` (no access) and `datamart` (read-only access), but have access to `test` and `personal databases`.

My issue appears when some user create `MaterializedView` over `datamart.some_table` with incorrect types.
For example:
```
create table test.user_table (id Int64);

create materialized view test.user_mv to test.user_table
as select from datamart.some_table; --<< in this table: `id` Nullable(Int64)
```

This action will broke all chain of materialized view (`cannot cast Nullable(Int64) to Int64`) when some nullable value will be received. And may cause data loss, if it was not detected in time (ttl in kafka).

### Describe the solution you'd like

Add syntax for revoke permissions:

`revoke create materialized view on *.* from user;`

### Describe alternatives you've considered

No alternative at the moment

### Additional context

1. We should also should keep permissions for regular views
2. We cannot set `materialized_views_ignore_errors` for whole cluster - initial chain is important, but user part is not.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.