How to Configure GitHub Copilot ClickHouse Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up github copilot clickhouse read only access by creating a restricted database user. Then you limit that user to select permissions before the AI assistant runs queries. Many engineering teams start by sharing a single admin account across their local tools. That approach is fast at first. Still, broad permissions let an automated assistant drop tables or change live rows by mistake. Setting up strict read permissions prevents accidental writes while letting the assistant inspect your s

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 github copilot clickhouse read only access by creating a restricted database user. Then you limit that user to select permissions before the AI assistant runs queries. Many engineering teams start by sharing a single admin account across their local tools. That approach is fast at first. Still, broad permissions let an automated assistant drop tables or change live rows by mistake. Setting up strict read permissions prevents accidental writes while letting the assistant inspect your schema.

How to set up github copilot clickhouse read only access

ClickHouse manages users, roles, row policies, settings profiles, and quotas as SQL access entities. Before you create accounts with SQL, you must turn on SQL-driven access control. This step requires a storage directory on the server. It also requires at least one existing user with access management turned on. Once that is ready, an admin with user creation rights can make a dedicated account. When you create the user, you pick how the account logs in. You can also limit which hosts the user can connect from. Also, you can assign default roles and specific user settings right away.

Remember that a user can only grant privileges that they already hold themselves. For an AI assistant, you should grant only select privileges on the target tables. You can even grant select rights on specific columns rather than the whole table. If you grant access to only two columns, the user can query only those two. A query that asks for all columns with a star will fail and return nothing. The only exception is when the table holds only those granted columns. If your database has many similar tables, you can grant select rights by name prefix. You do this by placing a trailing asterisk at the end of the table prefix.

How the AI assistant connects to the database

GitHub Copilot works inside your code editor and can run tasks in agent mode. Developers often wire their AI assistants to external databases through tool servers or shell commands. In these setups, the local tool holds the database login string on the developer machine. Vendor guides advise teams to put a read-only database user in that login string. This ensures that queries from the assistant cannot change or delete your stored data. You should also verify that you trust any local tool server before you connect it.

What native database roles solve and what they miss

Native database roles and column grants solve a major part of the safety problem. They stop the assistant from running inserts, updates, or table drops against your cluster. Column grants also let you leave out specific columns when you set up the role. Still, native database roles only check who logs in and which tables they can read. Once a user has select rights on a column, the database returns the raw values.

Auditor Read-Only Access + ClickHouse Access Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Real tables often hold emails, phone numbers, card numbers, or national IDs inside text columns. A static role cannot rewrite those matched fields in query results on the fly. Also, storing database passwords in local config files leaves static keys on every laptop. Native roles do not require a human to approve a heavy query before it runs. Teams still need a way to inspect queries in flight and mask sensitive fields.

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 sits inline in the native TCP protocol beside the server as a sidecar for your ClickHouse. For every production query an agent or human sends, hoop.dev decides whether to pass, mask, block, or escalate it for review.

With hoop.dev ClickHouse support, guardrails refuse banned queries before they run or hold risky calls for approval, and data masking rewrites matched string columns in results in memory. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Can I restrict an AI assistant to specific ClickHouse columns?

Yes, you can grant select permissions on individual columns instead of the entire table. If the assistant runs a select-all query, the database refuses it unless all columns are granted.

What do I need before creating ClickHouse users with SQL?

You must configure a storage directory for access control on the ClickHouse server. You also need an initial account with access management rights and user creation privileges.

Why is a read-only database user not enough for AI coding tools?

A read-only role stops data changes, but it still returns raw text from allowed columns. It also leaves database credentials sitting in local config files on developer machines.

The query runs. The emails stay hidden.