system.query_log, and answer questions with analytical SQL. CloudThinker signs in as a ClickHouse user over the HTTP interface, and a new connection is read-only.
Prerequisites
- A ClickHouse server reachable from CloudThinker on its HTTP interface:
8443with TLS,8123without. ClickHouse Cloud and self-hosted clusters both work. The native TCP port (9000) is not used. - An admin login on ClickHouse to create a dedicated user. On ClickHouse Cloud, run the Setup SQL in the service’s SQL console as the
defaultuser. - The workspace Admin role in CloudThinker to add the connection. See How access works.
Setup
1
Create a dedicated user with read access
Connect as an admin and run:On ClickHouse Cloud, the password must meet the service’s complexity rules (length, mixed case, a digit, and a special character), or Check the user exists on every node with
CREATE USER fails.The system.* grants power table health and slow-query answers. Skip them and those questions fail while schema questions still work.On a self-hosted cluster with several nodes, a user created this way exists only on the node you ran it on, unless the cluster replicates access storage. Run this version instead, with your cluster name:SELECT name FROM clusterAllReplicas('<cluster>', system.users) WHERE name = 'cloudthinker'.2
Lock the user to read-only at the server (recommended)
Skip this step if you plan to turn Write access on. Otherwise, add a settings profile so ClickHouse itself refuses writes, whatever any client asks for:The profile doesn’t break CloudThinker. Reads work as normal, and ClickHouse itself refuses every write.
3
Open network access
These docs don’t publish CloudThinker’s egress IP list: ask your CloudThinker contact, or contact us. Then:
- ClickHouse Cloud: add them to the service’s IP access list under the service Settings → Security.
- Self-hosted: allow inbound
8443(or8123) from them in your firewall or security group.
4
Add the connection in CloudThinker
Go to More → Workspace settings → Connections, select ClickHouse, fill in the fields from Connection details, leave Write access on Read-only (default), and click Connect.CloudThinker runs one
SELECT version() as that user.Success state: ClickHouse shows a Connected status, and the message reads ClickHouse <version> reachable as cloudthinker.Connection details
Required permissions
The Setup grants cover everything read-only. Add write grants only if you set Write access to Full access, and only on the databases the agent should change:Agent capabilities
system.query_log and system.parts are kept per node. On a cluster with several replicas, answers cover only the node that took the query. To cover every node, ask for it in the prompt:
- Self-hosted: “use
clusterAllReplicas('<cluster>', system.query_log)” - ClickHouse Cloud: “use
clusterAllReplicas('default', system.query_log)”
Verify the connection
Example prompts
Write access
Before you choose Full access:
- Blocked protects the table, not the rows.
ALTER TABLE ... DELETE,DROP PARTITION, andDROP COLUMNstill run and still remove data. Treat Full access as “the agent can destroy data”. - Nothing rolls back. ClickHouse has no transactions, so recovery means restoring from a backup.
READONLY profile from Setup step 2, lift it first or ClickHouse keeps refusing writes:
Rotate the password
- Set a new password on the ClickHouse user:
The old password stops working at once, so CloudThinker’s queries fail until you finish step 2. Do both steps together.
- Open More → Workspace settings → Connections, select ClickHouse, click the pencil icon on the instance’s row, and in Edit Instance click Replace…. Enter the new Password and click Save and test.
Troubleshooting
The first four titles match the connection test’s messages, so you can search this page for yours. The fifth is ClickHouse’s own error text, and the sixth is a symptom you see in chat.ClickHouse rejected the username or password
ClickHouse rejected the username or password
Check the user exists with
SHOW USERS;, then retype the password instead of pasting it. A value with a line break is rejected before CloudThinker contacts the server. On ClickHouse Cloud, create a database user rather than reusing a console sign-in.ClickHouse is unreachable, or rejected the request path
ClickHouse is unreachable, or rejected the request path
- Port and Use TLS must agree:
8443with TLS,8123without.9000is the native TCP port, not the HTTP interface. - Host must have no
https://prefix and no:portsuffix. - On ClickHouse Cloud, add CloudThinker’s egress IPs to the service IP access list. Self-hosted, check the firewall and that
<listen_host>covers the exposed interface.
ClickHouse did not answer in time
ClickHouse did not answer in time
On ClickHouse Cloud, an idle service suspends and connections time out until it wakes. Wake the service in the ClickHouse Cloud console, then connect again.
ClickHouse has no database named ...
ClickHouse has no database named ...
The Default database doesn’t exist. Names are case-sensitive. Fix the spelling or leave the field blank.
Cannot execute query in readonly mode
Cannot execute query in readonly mode
The connection is read-only, which is the default. If the agent should write, reconnect with Write access set to Full access (see Write access). If it still fails, the limit is on the server: run
SHOW CREATE USER cloudthinker; and look for a readonly settings profile or missing write grants.The table list is empty
The table list is empty
The user needs
SHOW TABLES and SELECT on the database, not only on single tables, plus SELECT on system.tables.Security
- Least privilege — grant only the permissions the agents need for your use case; start read-only and widen later.
- Read-only by default — use read-only credentials unless you want agents to make changes through this connection.
- Rotate credentials — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
- Revoke on offboarding — remove the credential at the provider when you delete a connection or a teammate leaves.
- Grants over switches: the privileges on the ClickHouse user decide what’s possible. Write access only decides what CloudThinker asks for.
- Server-side read-only: for a connection that must never write, keep the
READONLYsettings profile from Setup step 2. No client can lift it.
Related
PostgreSQL Connection
Connect a PostgreSQL database the same way
Connections overview
How credentials and write controls work across connections
Approvals
How approvals work on connections that support them