= Clickhouse read-only mode =
You need to be careful when you use a read-only Clickhouse user in your APIs.
The default read-only mode (readonly = 1
) will effectively prevent you from
changing any query settings, e.g. join_use_nulls
,
enable_unaligned_array_join
, etc. In order to make this work with the
read-only mode, you need to set up the readonly
flag to 2
in the
users.xml
:
<profiles>
<readonly>
<readonly>2</readonly>
</readonly>
</profiles>
<users>
<apiuser>
<profile>readonly</profile>
</ltvapi>
</users>
With the above in place, your queries will be able to setup query settings yet again.
From the official documentation:
Read-only mode is enabled by the readonly setting (not to confuse with readonly constraint type):
readonly=0
: No read-only restrictions.readonly=1
: Only read queries are allowed and settings cannot be changed unless changeable_in_readonly is set.readonly=2
: Only read queries are allowed, but settings can be changed, except for readonly setting itself.