How to Configure Cline ClickHouse Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up cline clickhouse read only access by creating a restricted database user. Then you grant select permissions on target tables and give those credentials to your agent. Many engineering teams start by sharing an admin account with their coding assistant. This fast shortcut creates huge risks for production data. A single bad prompt can lead to dropped tables or altered schemas. Overbroad database roles also expose private customer records during routine debugging tasks. Limiting what yo

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 cline clickhouse read only access by creating a restricted database user. Then you grant select permissions on target tables and give those credentials to your agent. Many engineering teams start by sharing an admin account with their coding assistant. This fast shortcut creates huge risks for production data. A single bad prompt can lead to dropped tables or altered schemas. Overbroad database roles also expose private customer records during routine debugging tasks. Limiting what your coding tool can read and run is essential for database safety.

How to set up cline clickhouse read only access

ClickHouse manages users, roles, row policies, settings profiles, and quotas as SQL access entities. To use SQL access control, you must set up a storage directory on the server. You also need at least one database user with access management rights turned on. An admin can only grant privileges that they hold themselves. Creating a new user takes the create user privilege in the database. During user creation, you define the login method and allowed client hosts. You also assign default roles and specific user settings for the account.

To lock down the agent, you grant select privileges on specific tables or columns. ClickHouse lets you grant select rights on individual columns within a table. When a user only has rights for two columns, queries on other columns fail. Running a select all query also fails unless the table holds only those granted columns. In newer database versions, you can grant select rights using a table name prefix. A trailing asterisk in the grant statement matches all tables sharing that prefix. Once the database role is ready, you pass the credentials to Cline. The coding agent uses local tools or servers to run queries with that restricted user.

What native read only roles solve and what they miss

Native database roles stop the coding agent from changing or deleting your stored data. The agent cannot drop tables, insert bad rows, or alter table structures. Column grants also help you block access to specific columns in a table. This native setup works well for basic schema checks and simple data lookups. It defines who can log in and which objects they can read.

Still, static database grants do not inspect what individual queries do in flight. Even a read only query can scan billions of rows and overload the server. If a granted table holds sensitive columns, the agent still pulls raw text into prompts. Emails, phone numbers, card numbers, and national IDs can flow straight to external models. Also, storing plain database passwords on developer laptops creates a constant secret sprawl risk. If a local config file leaks, attackers gain direct entry to your analytics store. Shared static accounts also make audit logs hard to read during security reviews. Every query from the laptop looks the same in the database history.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Why runtime controls matter for AI database workflows

Coding assistants run fast and generate many queries during a single debugging session. Static permissions cannot adapt to the context of each prompt or task. Teams need a way to inspect queries before the database runs them. They also need a method to rewrite matched fields in query results. Masking emails, phone numbers, card numbers, and national IDs keeps private text out of prompts. Pairing native select grants with active query checks closes the gap for engineering teams. Developers keep their fast agent workflows while security teams keep control over production data.

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

Can ClickHouse restrict an AI agent to specific columns?

Yes, ClickHouse supports column-level select grants for users and roles. If an agent runs a select all query on a partially granted table, the query fails. The database returns no data unless the user has rights to every column.

How do you grant read access to multiple tables by prefix in ClickHouse?

Since version 24.10, you can use a trailing asterisk in your grant statement. This lets you grant select rights across all tables that share a specific name prefix. It saves time when managing many related analytics tables.

Why are read-only database roles not enough for AI coding agents?

Read-only roles stop data changes, but they do not filter raw data in results. Sensitive fields like emails or card numbers still reach the model context. Static roles also require storing credentials on local machines where agents run.

The query runs. The emails stay hidden.