Queries in ClickHouse can be divided into several types:
- Read data queries:
SELECT,SHOW,DESCRIBE,EXISTS. - Write data queries:
INSERT,OPTIMIZE. - Change settings query:
SET,USE. - DDL queries:
CREATE,ALTER,RENAME,ATTACH,DETACH,DROPTRUNCATE. KILL QUERY.
The following settings regulate user permissions by the type of query:
readonly
Restricts permissions for read data, write data, and change settings queries.
When set to 1, allows:
- All types of read queries (like SELECT and equivalent queries).
- Queries that modify only session context (like USE).
When set to 2, allows the above plus:
- SET and CREATE TEMPORARY TABLE
Possible values:
- 0 — Read, Write, and Change settings queries are allowed.
- 1 — Only Read data queries are allowed.
- 2 — Read data and Change settings queries are allowed.
Default value: 0
allow_ddl
Allows or denies DDL queries.
Possible values:
- 0 — DDL queries are not allowed.
- 1 — DDL queries are allowed.
Default value: 1