How to Configure Gemini CLI ClickHouse Prevent Delete
To set up a gemini cli clickhouse prevent delete rule, assign a read-only database role to the agent user. You grant select rights on specific tables and leave out delete permissions. Teams often hook coding agents right to analytics databases using shared admin keys. When an agent runs with full rights, one bad prompt can wipe out live tables. A broad role lets the tool drop data or run heavy updates by mistake. Scoping down what the agent can do at the database level stops these errors early.
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.
To set up a gemini cli clickhouse prevent delete rule, assign a read-only database role to the agent user. You grant select rights on specific tables and leave out delete permissions. Teams often hook coding agents right to analytics databases using shared admin keys. When an agent runs with full rights, one bad prompt can wipe out live tables. A broad role lets the tool drop data or run heavy updates by mistake. Scoping down what the agent can do at the database level stops these errors early.
How a gemini cli clickhouse prevent delete setup works
ClickHouse manages users, roles, row rules, settings profiles, and quotas as SQL access items. To turn on SQL access control, an admin sets up a storage path on the server. At least one admin user needs access management rights turned on first. That admin can then create a new user account just for the terminal agent. A user can only hand out permissions that they already hold themselves.
When you create the agent user, you set how it logs in and which hosts can reach the server. You also assign a default role that holds only read rights. Instead of giving full table rights, you can grant select permissions on chosen columns. If an agent only has rights to two columns, it can query only those two fields. Any query that asks for other columns or uses a star query gets blocked right away. The database returns no data at all unless the table holds only those granted columns. You can also grant select rights across a group of tables using a shared name prefix.
Why native roles are not enough for terminal agents
Terminal coding agents run shell commands and database tools on behalf of the developer. They read local shell files and pick up saved keys from the user machine. If a developer stores an admin key in a local file, the agent uses that key. The database sees a valid login and gives the agent full power to delete rows.
Even when you set up a strict read-only user, static database roles have clear limits. Native roles decide who can log in and which tables they can read. They do not inspect what each query does while it runs in flight. A read-only role stops a delete statement, yet it still allows a full read of sensitive columns. If you grant read rights on a customer table, query results can include emails, phone numbers, and card numbers. Static grants also cannot require a human check when an agent wants to run a rare cleanup task. Teams then share a second write key, which brings back the risk of accidental data loss.
ClickHouse Access Management + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Adding query checks and field masking for safer agent runs
A safer approach separates user identity from raw database keys and checks every query in flight. Instead of storing static passwords on laptops, developers and agents log in with short-lived sessions. Each statement goes through a check before the database ever runs it. You can block delete and drop commands by default while allowing safe select queries to pass.
When a select query runs against customer tables, data masking rewrites matched fields in results. Sensitive values like emails, phone numbers, card numbers, and national IDs get replaced before returning to the terminal. If an engineer or agent needs to run a single delete statement, they can ask for one-time approval. A team lead reviews the exact query and approves it for that single run. Every query and result check gets written to an audit log so the team knows what ran.
Check ClickHouse queries and results before execution
Access control in ClickHouse is essential setup. Setup alone does not check single queries for risk or rewrite sensitive strings in returned rows. By design, hoop.dev sits inline in the protocol beside the server as a sidecar for your ClickHouse. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human approval.
First, hoop.dev guardrails block disallowed deletes, drops, and alter mutations or hold them for review. Then hoop.dev data masking rewrites sensitive string columns in responses in memory and logs each decision per resource. Read the docs and source on GitHub.
Frequently asked questions
How do I stop a coding agent from deleting ClickHouse rows?
Create a dedicated ClickHouse user for the agent with SQL access control turned on. Grant only select permissions on the needed tables and leave out delete or alter rights.
What happens if the agent runs a star query on restricted columns?
ClickHouse blocks the star query and returns no data at all. The query only works if the table contains only the exact columns granted to that user.
How can we protect emails and card numbers during agent queries?
Column grants can block some fields, and dynamic data masking rewrites matched fields in results. Masking replaces emails, phone numbers, card numbers, and national IDs in query output by default.
Related guides
In this post