How to Configure AutoGen ClickHouse Prevent Delete
You set up an autogen clickhouse prevent delete workflow by assigning read-only roles to agents. You give the agent account select permissions and omit all delete and drop rights. Engineering teams often build multi-agent apps that query analytics tables to answer questions. Developers sometimes connect these agents with broad admin credentials during fast testing cycles. If an agent gets full write rights, one bad prompt can wipe out tables. Restricting the database user stops destructive state
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 an autogen clickhouse prevent delete workflow by assigning read-only roles to agents. You give the agent account select permissions and omit all delete and drop rights. Engineering teams often build multi-agent apps that query analytics tables to answer questions. Developers sometimes connect these agents with broad admin credentials during fast testing cycles. If an agent gets full write rights, one bad prompt can wipe out tables. Restricting the database user stops destructive statements before they can damage your stored data.
How to set up autogen clickhouse prevent delete in native roles
ClickHouse manages users, roles, row policies, settings profiles, and quotas as SQL access entities. To use SQL-driven access control, you first set a storage directory on the server. You also need at least one admin user with access management turned on. That admin user can only grant privileges that they already hold themselves.
Creating a new agent account requires the create user privilege on the database server. During user creation, you define the login method and the allowed client hosts. You also assign default roles and specific user settings for the AutoGen worker. Next, you grant select rights on the target tables and skip delete rights. You can even grant select rights on specific columns instead of the whole table. If you restrict columns, the database refuses full-table wildcard queries and returns no data. Wildcard queries only work when the table holds just the allowed columns. Since version 24.10, a trailing asterisk lets you grant rights by table name prefix.
What native database roles solve and what they miss
Native database roles stop an AutoGen agent from deleting rows or dropping tables. The database engine checks the role at login and blocks any forbidden write command. This setup protects your core tables from accidental mutations during automated agent runs.
Still, static database roles only decide who can log in and which tables open. They do not inspect what individual queries do in flight during a live session. An agent with select rights on a table can still read sensitive user columns. Maintaining column grants across hundreds of tables takes constant manual work from your team. If a table schema changes, your column grants can break agent queries right away. Also, shared agent credentials make it hard to trace which specific task ran a query. Teams need a way to inspect queries and mask fields like emails or phone numbers.
ClickHouse Access Management + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Managing credentials and query checks for AI agents
AutoGen apps often run many specialized agents that share one database login key. Storing static passwords in agent code or text files creates a major security risk. If a developer logs the agent setup, those plain keys can leak into storage. Rotating those static keys also requires updating both the database and the agent app.
A strong setup separates the agent code from the raw database login keys. It also checks every SQL statement before the database engine runs the query. When results return, data masking rewrites matched fields like card numbers or national IDs. This approach keeps data safe without forcing admins to rebuild column grants every week.
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
Can an AutoGen agent run wildcard queries with column-level select grants?
No, ClickHouse refuses wildcard select queries when a user only has partial column grants. The query returns no data unless the table contains only the granted columns.
What privileges are needed to create a restricted ClickHouse user for AutoGen?
The admin needs the create user privilege and access management enabled on their account. A database user can only grant privileges that they already hold themselves.
How do you grant read access to multiple tables sharing a name pattern?
Since ClickHouse version 24.10, you can use a trailing asterisk in your grant statement. This grants select rights across all tables that match the given name prefix.
Related guides
In this post