How to Configure AutoGen ClickHouse Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up autogen clickhouse read only access by making a dedicated database user. Then you grant that user permission to read only specific tables or columns. Many teams start by giving their AI agents an existing admin account. That shortcut lets an agent alter tables or read sensitive data by mistake. A strict read role keeps your analytical data safe while agents run queries. How autogen clickhouse read only access works AutoGen agents use tools and functions to talk to external data sto

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 autogen clickhouse read only access by making a dedicated database user. Then you grant that user permission to read only specific tables or columns. Many teams start by giving their AI agents an existing admin account. That shortcut lets an agent alter tables or read sensitive data by mistake. A strict read role keeps your analytical data safe while agents run queries.

How autogen clickhouse read only access works

AutoGen agents use tools and functions to talk to external data stores. When an agent needs numbers, it writes a query and runs a database tool. That tool logs in to ClickHouse with the user credentials you provide. If those credentials belong to a restricted account, the database blocks any changes.

ClickHouse manages users, roles, row policies, settings profiles, and quotas through SQL. Before you make accounts with SQL, you must set up a storage directory. You also need at least one initial account with access management turned on. That admin user can only grant permissions that it already holds itself.

To make the agent account, an admin runs the user creation permission. During creation, you set how the user logs in and which hosts can connect. You can also attach default roles and user settings right away. Next, you grant read permissions on the exact tables the agent needs.

ClickHouse also lets you grant read rights on single columns in a table. The agent can then query only those allowed columns in its statements. If an agent tries to select all columns with a wildcard, ClickHouse refuses. It returns no data at all unless the user holds rights to every column. In version 24.10 and newer, a trailing asterisk grants rights by table name prefix.

What native roles solve and what they leave open

Database roles and column grants stop an AutoGen agent from changing your tables. They also stop the agent from reading tables outside its assigned scope. This setup works well when every allowed column holds safe, public numbers. The database checks who logs in and enforces the table rules on each query.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, static grants do not check what happens to data inside allowed columns. An agent often needs to read a customer table to count orders or signups. If that table holds emails, phone numbers, or card numbers, column grants fall short. Blocking the whole column breaks workflows that need to group or filter records. Allowing the column sends raw personal data straight into the model prompt.

Static database accounts also rely on long-lived passwords stored in the agent app. Every agent worker shares the same login identity inside the database logs. When a bad query slows the cluster, you cannot tie it to one user. You only see the shared agent account name in the system log. Static roles decide who logs in, not what individual queries return in flight. Teams also need dynamic data masking that rewrites matched fields like national IDs in results.

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 runs beside the server as a sidecar for your ClickHouse and checks native TCP queries with no change to your drivers.

With hoop.dev ClickHouse support, guardrails refuse banned queries before they run, and data masking rewrites matched string columns in results. The audit trail logs which entity types were masked and how many without storing raw values. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Why did ClickHouse refuse a wildcard query from my AutoGen agent?

When you grant read rights on specific columns only, ClickHouse blocks wildcard queries. The database returns no data unless the user has rights on every column. Prompt your agent to name each allowed column in its select statement.

Can I grant read rights to a group of tables at once?

Yes, starting in ClickHouse version 24.10, you can use a trailing asterisk. This lets you grant read permissions to all tables that share a name prefix.

What do I need before making ClickHouse users with SQL?

You must configure a storage directory on the server for access entities. You also need an initial account with access management and named collection control enabled.

The query runs. The emails stay hidden.