How to Configure n8n ClickHouse Permissions

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up n8n clickhouse permissions by creating a dedicated database user with strict read-only grants. Then you add those user credentials to your n8n workflow nodes. Most teams start by sharing a default admin account across every workflow. That approach gives every workflow and AI agent full control over all tables. A single bad query can drop tables or expose private rows. How to set up n8n clickhouse permissions ClickHouse manages users, roles, row policies, settings profiles, and quot

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 n8n clickhouse permissions by creating a dedicated database user with strict read-only grants. Then you add those user credentials to your n8n workflow nodes. Most teams start by sharing a default admin account across every workflow. That approach gives every workflow and AI agent full control over all tables. A single bad query can drop tables or expose private rows.

How to set up n8n clickhouse permissions

ClickHouse manages users, roles, row policies, settings profiles, and quotas through SQL statements. Before you create accounts, you must turn on SQL-driven access control on the server. This setup needs a storage directory and an admin account with access management turned on. Once active, an admin can create a new user account just for n8n. Remember that a database user can only grant privileges that they already hold themselves.

When you create the n8n user, you set its login method and allowed client hosts. You also assign default roles and specific settings profiles for that account. For most workflows, you should grant read access only to the tables n8n needs. ClickHouse lets you grant select rights on specific columns in a table. If a user only has rights on two columns, queries for other columns fail. Even a select-all query will fail unless the table only has those granted columns. In version 24.10 and newer, you can also grant rights by table name prefix.

Inside n8n, workflows and AI Agent nodes use these credentials to run queries. An n8n AI Agent node pairs a chat model with one or more tool sub-nodes. The agent decides which tool to call to finish its task. You can attach an HTTP Request Tool, a Custom Code Tool, or a sub-workflow tool. Each attached tool runs queries using the static ClickHouse account you configured.

Why static database roles fall short for workflows

Native database roles work well when one workflow does one simple job. They verify which service logs in and block access to unapproved tables. Still, n8n workflows often serve many users and run dynamic queries. All those queries share the exact same database user and permissions.

This creates a gap when you build with the n8n AI Agent node. Starting in n8n 1.82.0, all AI Agent nodes run as a Tools Agent. The chat model picks the tool and shapes the query based on user prompts. Static database grants only check who logs in at the start of the session. They do not inspect what each individual statement does while in flight.

ClickHouse Access Management + AI Agent Permissions: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Column grants also have hard operational limits for shared analytics tables. If a column holds emails, phone numbers, card numbers, or national IDs, you face a choice. You must either block the whole column or expose raw values to every workflow run. Native database roles cannot rewrite matched fields in results dynamically per request. They also cannot pause a risky query for human approval before it runs.

Where runtime query controls fit in your stack

To close this gap, teams pair native ClickHouse roles with runtime controls. First, keep your ClickHouse user locked down to specific hosts, tables, and columns. Second, add a check that inspects each query from n8n before it hits the database. This approach lets you log every query tied to the specific workflow or user. It also lets you mask sensitive fields like emails or card numbers in query 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

What privileges does an admin need to create a ClickHouse user for n8n?

The admin needs the create user privilege and SQL-driven access control turned on. A user in ClickHouse can only grant privileges that they already hold themselves.

Why do select-all queries fail after restricting ClickHouse column permissions?

When you grant select on specific columns, ClickHouse blocks select-all queries on that table. Your n8n workflow must name the exact allowed columns in every select query.

How do n8n AI Agent nodes run queries against ClickHouse?

An n8n AI Agent node connects a chat model to tool sub-nodes like HTTP requests. The agent decides when to call the tool, which then runs the ClickHouse query.

The query runs. The emails stay hidden.