How to Configure Cursor ClickHouse Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up cursor clickhouse read only access by creating a restricted database user. Then you pass those read-only login details to your editor tools. Many teams start by sharing a default admin account with their coding agent. That broad role lets the agent drop tables or change production data by mistake. A dedicated read-only user stops write commands at the database level. How to set up cursor clickhouse read only access in ClickHouse ClickHouse manages users, roles, row policies, settin

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up cursor clickhouse read only access by creating a restricted database user. Then you pass those read-only login details to your editor tools. Many teams start by sharing a default admin account with their coding agent. That broad role lets the agent drop tables or change production data by mistake. A dedicated read-only user stops write commands at the database level.

How to set up cursor clickhouse read only access in ClickHouse

ClickHouse manages users, roles, row policies, settings profiles, and quotas through SQL commands. Before you create users with SQL, you must turn on SQL-driven access control. This step needs a storage folder on the server for access files. It also needs at least one existing user with access management rights turned on.

Once you turn that on, an admin can create a new user account. The admin must hold the privilege to create users and grant permissions. In ClickHouse, a user can only grant privileges that they already hold themselves. During user creation, you set the login method and allowed client hosts. You can also assign default roles and custom user settings right away.

Next, you grant select rights on the target tables to the new user. ClickHouse lets you grant select rights on the whole table or specific columns. If you grant select on two columns, the user can only query those columns. Any query that asks for a third column will fail right away. A select-all query also fails unless the table only has those granted columns. Starting in version 24.10, you can also grant select rights by table name prefix. A trailing star in the grant statement matches all tables with that prefix.

How the coding agent runs queries and where gaps remain

AI coding editors reach external databases through Model Context Protocol servers or shell commands. When you set up a database tool, you give it a connection string. Vendor docs tell teams to put a read-only database user in that string. That way, the queries the agent runs cannot change or delete your data. You should also check that you trust any tool server before you use it.

Native database roles solve the write risk well. The database rejects any insert, update, or drop command from the read-only account. Still, native setup only checks who logs in and which columns they can read. It does not inspect what individual queries do in flight.

Auditor Read-Only Access + ClickHouse Access Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

First, the local tool config still holds a plain database password on disk. Anyone who reads that local file can copy the database login details. Second, column grants are all or nothing for each column you expose. If an agent needs a customer table to debug an issue, it reads raw rows. Those rows might hold emails, phone numbers, card numbers, or national IDs. Native column grants cannot rewrite matched fields in results while keeping the column queryable. Third, database logs only show the shared read-only user name. They do not tie each query back to the specific developer who prompted the agent.

Why column grants alone miss sensitive fields

Maintaining column-level grants across hundreds of tables takes constant manual work. Every time a team adds a table or column, someone must update the grants. If an engineer forgets one column, raw sensitive data goes straight to the model context. If you lock down too many columns, select-all queries fail and break normal debugging.

Teams also struggle with shared text columns like JSON payloads or event logs. A single log column can hold safe app metrics right next to emails or card numbers. ClickHouse column grants cannot split a single column into safe and unsafe parts. You either allow the whole column or block the agent from reading logs at all. To keep agents useful and safe, teams need controls that inspect results in flight.

Add runtime guardrails and masking beside ClickHouse

Database grants and network rules control who can reach ClickHouse. Even so, an allowed client or agent can send an alter mutation that deletes rows or read raw personal data. In practice, hoop.dev sits inline in the native TCP protocol beside the server as a sidecar for your ClickHouse. For every production query an agent or human sends, hoop.dev decides whether to pass, mask, block, or escalate it for review.

With hoop.dev ClickHouse support, guardrails refuse banned queries before they run or hold risky calls for approval, and data masking rewrites matched string columns in results in memory. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Why do select-all queries fail for a restricted ClickHouse user?

When you grant select on specific columns only, ClickHouse blocks select-all queries on that table. The query only works if the table contains nothing but the granted columns. Ask the agent to list the allowed column names in its select query instead.

Can a ClickHouse user grant read access to another user for Cursor?

Only if that user has access management rights and holds those exact select privileges. In ClickHouse, a user can never grant privileges that they do not hold themselves.

Does a read-only database user stop sensitive data from reaching the AI model?

No, a read-only role only stops the agent from changing or deleting data. If a granted column contains emails, phone numbers, or card numbers, the query returns them. You need data masking in flight to rewrite matched fields in results.

The query runs. The emails stay hidden.