How to Configure n8n ClickHouse Credentials

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up n8n clickhouse credentials, create a restricted database user with SQL-driven access control. Then save the host, port, username, and password in your n8n workflow settings. Many teams start by reusing an admin account so workflows run right away. That shortcut gives every automated step and AI agent full control over your analytical tables. A bad query or prompt can then read private data or drop production records. How to set up n8n clickhouse credentials Start inside your databas

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 n8n clickhouse credentials, create a restricted database user with SQL-driven access control. Then save the host, port, username, and password in your n8n workflow settings. Many teams start by reusing an admin account so workflows run right away. That shortcut gives every automated step and AI agent full control over your analytical tables. A bad query or prompt can then read private data or drop production records.

How to set up n8n clickhouse credentials

Start inside your database before you open your workflow tool. ClickHouse manages users, roles, row policies, settings profiles, and quotas through SQL statements. To turn on SQL-driven access control, configure the server storage directory for access entities. You also need at least one initial account with access management turned on. Once enabled, an admin can create a dedicated account for your workflow tool. Keep in mind that a user can only grant privileges they already hold.

When you create the account, define how it logs in and where it connects from. You can lock the account to specific client hosts and assign default roles. You can also attach per-user settings profiles and quotas to cap resource use. Next, grant read permissions only on the tables your workflow needs to read. ClickHouse lets you grant select rights on specific columns instead of full tables. If an account only has permissions on two columns, it can query only those two. A wildcard query across all columns will fail and return no data at all. This happens unless the table contains only those exact granted columns. From version 24.10 onward, you can also grant permissions by table name prefix.

On the workflow side, teams connect ClickHouse through HTTP requests, custom code, or sub-workflows. If you build with the n8n AI Agent node, you combine a chat model with tools. The agent then decides which tools to call to finish a task. Every AI Agent node requires at least one connected tool sub-node to work. Because all recent agent nodes work as a Tools Agent, you have several options. You can wire up an HTTP Request Tool, a Custom Code Tool, or a sub-workflow. You can also connect a server from the MCP registry to run queries. Store the database user details in the workflow credential store and link them to your node.

What native database roles solve and what they miss

Native database roles and host checks solve the basic problem of who can log in. Column grants stop a workflow from reading columns outside its assigned scope. Quotas and settings profiles also help stop a single user from starving the cluster. These built-in controls form a strong base for any automated pipeline.

Ephemeral Credentials + ClickHouse Access Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, static credentials still leave big gaps during daily operations. First, the workflow engine holds a long-lived password that sits in storage until someone rotates it. Every person with edit rights on the workspace can run nodes using that shared account. The database logs only show that the shared workflow user ran a statement. You lose track of which builder, webhook, or agent task triggered the query.

Second, static column grants are all-or-nothing rules. Sometimes an agent or workflow needs a column that holds emails or phone numbers. Native grants cannot mask card numbers or national IDs inside query results on the fly. If you grant the column, the workflow gets the raw text in full. Finally, database roles check permissions at login and table level, not per request context. They cannot pause a risky statement for human approval before it hits the cluster.

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 beside the server as a sidecar for your ClickHouse and parses every statement before execution.

First, hoop.dev guardrails block disallowed deletes, drops, and alter mutations. Then hoop.dev data masking rewrites sensitive string columns in responses and logs each decision per resource. Read the docs and source on GitHub.

Frequently asked questions

Why do wildcard queries fail with restricted n8n clickhouse credentials?

ClickHouse blocks wildcard select queries when a user only has column-level grants on a table. The query returns no data unless the table contains only those exact granted columns. Always list the specific allowed column names in your workflow queries.

How do n8n AI Agent nodes run queries against ClickHouse?

An n8n AI Agent node pairs a chat model with one or more tool sub-nodes. Since built-in SQL agent tools target Postgres or MySQL, teams use HTTP or custom tools. The agent picks the right tool sub-node to send the query and read results.

What is needed to create a least-privilege user in ClickHouse?

You must turn on SQL-driven access control by setting the access storage path on the server. Your admin account also needs the create user privilege and access management turned on. Remember that an account can only grant permissions that it already holds itself.

The query runs. The emails stay hidden.