How to Configure n8n ClickHouse Approval
You set up an n8n clickhouse approval flow by pausing workflows before queries run. You combine n8n wait steps with strict ClickHouse user roles to control database tasks. Many teams build AI agents that turn natural language prompts into database queries. They often give the automation tool a shared database login with broad permissions. If an agent makes a mistake, that broad role can drop tables or read private records. How native n8n clickhouse approval and database roles work In n8n, the
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 n8n clickhouse approval flow by pausing workflows before queries run. You combine n8n wait steps with strict ClickHouse user roles to control database tasks. Many teams build AI agents that turn natural language prompts into database queries. They often give the automation tool a shared database login with broad permissions. If an agent makes a mistake, that broad role can drop tables or read private records.
How native n8n clickhouse approval and database roles work
In n8n, the AI Agent node pairs a chat model with tool sub-nodes. The agent picks which tools to call so it can finish a task. You must attach at least one tool sub-node to the AI Agent node. Modern n8n versions treat every AI Agent node as a Tools Agent. To query ClickHouse, teams attach an HTTP Request Tool or a Call n8n Workflow Tool. They can also link a custom code tool or an MCP server tool.
To add human review in n8n, builders split the task into two steps. First, the agent drafts the SQL text and sends it to a sub-workflow. Second, the sub-workflow pauses and sends a message to a reviewer in chat or email. The workflow waits until a person clicks approve before it sends the request to ClickHouse.
On the database side, ClickHouse manages users, roles, row policies, settings profiles, and quotas. Admins create these entities with SQL once they turn on the access control directory. At least one admin user needs permission to manage roles and named collections. That admin can only grant privileges that they already hold themselves. When creating a user for n8n, the admin sets the login method and allowed hosts. They also assign default roles and specific per-user settings profiles.
Setting column grants for automated workflows
Good database hygiene means limiting what the n8n database user can read. ClickHouse lets admins grant read access on specific columns within a table. If an admin grants access to only two columns, the user can query only those two. A query that asks for all columns with an asterisk will fail and return nothing. It only works if the table holds no other columns beyond the granted ones. In newer ClickHouse releases, admins can also grant permissions across table prefixes using a trailing asterisk.
These column rules help keep automated workflows inside safe boundaries. Even if a workflow runs without a human check, column grants block broad table reads. Teams still pair these grants with row policies and quotas to cap resource use.
Approval Chains & Escalation + ClickHouse Access Management: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Where native workflow checks fall short
Building approval steps inside n8n works for simple workflows, but it scales poorly. Every builder on the team must remember to add the wait step to every workflow. If someone attaches an HTTP Request Tool directly to ClickHouse, the agent skips the review step. The database only checks who logs in, not whether a human approved that single statement.
Static database credentials stored inside n8n also create a security risk. Anyone who can edit workflows can use that stored credential in a new flow without review. Also, native column grants require tedious upkeep whenever schemas change. When a query returns emails, phone numbers, card numbers, or national IDs, ClickHouse sends the raw values. If a column is allowed, the workflow receives the full text instead of rewriting matched fields in results.
Audit logs also split across two different places. Reviewers approve a step in n8n, while ClickHouse logs only the shared service account name. Security teams struggle to tie a specific database command back to the person who approved it.
Check ClickHouse queries and result columns on the wire
ClickHouse users and row policies decide who connects. They do not check each statement on the wire or redact sensitive string columns in query results. With hoop.dev, you run an open-source proxy, a sidecar for your ClickHouse. It reads ClickHouse's native TCP protocol before queries run while ClickHouse stays in charge of login and grants.
Multi-statement queries and table mutations are split and checked by hoop.dev guardrails. Banned actions are refused with a native ClickHouse error. On returned rows, hoop.dev data masking rewrites String and FixedString columns that match your rules. The audit trail logs each query, table, and verdict. See the MIT-licensed source on GitHub.
Frequently asked questions
How do AI agents in n8n run queries against ClickHouse?
The n8n AI Agent node uses attached tool sub-nodes to interact with external systems. Builders connect an HTTP Request Tool, a Call n8n Workflow Tool, or an MCP tool to reach ClickHouse.
Why does a wildcard query fail for a restricted ClickHouse user?
When a ClickHouse user has column-level read grants, wildcard queries are refused and return no data. The query must name only the allowed columns unless the table holds no other columns.
Can ClickHouse tell if an n8n human reviewer approved a query?
No, native ClickHouse access control only verifies the user login, host, and granted role privileges. It cannot see whether a workflow paused for human approval inside n8n before sending the query.
Related guides
In this post